From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 5714 invoked from network); 17 May 1998 12:15:58 -0000 Received: from xorn.camelot.de (qmailr@195.30.227.63) by mail2.redhat.com with SMTP; 17 May 1998 12:15:58 -0000 Received: (qmail 2873 invoked by uid 8044); 17 May 1998 12:15:45 -0000 Message-ID: <19980517141544.A2867@math.fu-berlin.de> Date: Sun, 17 May 1998 14:15:44 +0200 From: Felix von Leitner To: axp-list@redhat.com, linux-kernel@vger.rutgers.edu, tar-bugs@gnu.ai.mit.edu Subject: Oops, new tar speedup patch Mail-Followup-To: axp-list@redhat.com, linux-kernel@vger.rutgers.edu, tar-bugs@gnu.ai.mit.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.92.5i Small omission in the group cache that would have marked all group lookups after the first one as failed. Sorry! Felix --- names.c Sun May 17 14:14:42 1998 +++ names.c.new Sun May 17 14:14:11 1998 @@ -48,6 +48,9 @@ static uid_t cached_uid; /* valid only if cached_uname is not empty */ static gid_t cached_gid; /* valid only if cached_gname is not empty */ +int lookup_failed = 0; +int glookup_failed = 0; + /*------------------------------------------. | Given UID, find the corresponding UNAME. | `------------------------------------------*/ @@ -111,12 +114,18 @@ passwd = getpwnam (uname); if (passwd) { + lookup_failed = 0; cached_uid = passwd->pw_uid; strncpy (cached_uname, uname, UNAME_FIELD_SIZE); } - else + else { + lookup_failed = 1; + strncpy (cached_uname, uname, UNAME_FIELD_SIZE); return 0; + } } + if (lookup_failed) + return 0; *uidp = cached_uid; return 1; } @@ -137,12 +146,18 @@ group = getgrnam (gname); if (group) { + glookup_failed = 0; cached_gid = group->gr_gid; strncpy (cached_gname, gname, GNAME_FIELD_SIZE); } - else + else { + glookup_failed = 1; + strncpy (cached_gname, gname, GNAME_FIELD_SIZE); return 0; + } } + if (glookup_failed) + return 0; *gidp = cached_gid; return 1; }