opkg_svn: fixed broken uname gname cache (this significantly speeds up)
[vuplus_openvuplus_3.0] / meta-openvuplus / recipes-devtools / opkg / opkg / unarchive-fixed-uname-gname-cache.patch
1 diff -Naur trunk.org/libbb/unarchive.c trunk/libbb/unarchive.c
2 --- trunk.org/libbb/unarchive.c 2012-08-30 13:45:44.000000000 +0200
3 +++ trunk/libbb/unarchive.c     2012-09-13 11:50:57.822754393 +0200
4 @@ -446,12 +446,12 @@
5         struct passwd *passwd;
6         if (!uname)
7                 return FALSE;
8 -       if (!uname_cache[0] && strcmp(uname_cache, uname) == 0)
9 +       if (!strcmp(uname_cache, uname))
10                 return TRUE;
11         passwd = getpwnam(uname);
12         if (passwd) {
13                 uid_cache = passwd->pw_uid;
14 -               strncpy(uname, uname_cache, 32);
15 +               strncpy(uname_cache, uname, 32);
16                 return TRUE;
17         }
18         return FALSE;
19 @@ -464,12 +464,12 @@
20         struct group *group;
21         if (!gname)
22                 return FALSE;
23 -       if (!gname_cache[0] && strcmp(gname_cache, gname) == 0)
24 +       if (!strcmp(gname_cache, gname))
25                 return TRUE;
26         group = getgrnam(gname);
27         if (group) {
28                 gid_cache = group->gr_gid;
29 -               strncpy(gname, gname_cache, 32);
30 +               strncpy(gname_cache, gname, 32);
31                 return TRUE;
32         }
33         return FALSE;