mirror of
https://github.com/opnsense/src.git
synced 2026-04-24 23:57:30 -04:00
Fix username/groupname cache so it returns a name that
was just looked up by get{pw,gr}id(). Otherwise, it
returns a NULL name unless it's already in the cache.
Credit to Juergen Lock.
This commit is contained in:
parent
9214908dca
commit
7e02198e95
1 changed files with 2 additions and 0 deletions
|
|
@ -1113,6 +1113,7 @@ lookup_uname(struct bsdtar *bsdtar, uid_t uid)
|
|||
} else if (pwent->pw_name != NULL && pwent->pw_name[0] != '\0') {
|
||||
cache->cache[slot].name = strdup(pwent->pw_name);
|
||||
cache->cache[slot].id = uid;
|
||||
return (cache->cache[slot].name);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
|
@ -1146,6 +1147,7 @@ lookup_gname(struct bsdtar *bsdtar, gid_t gid)
|
|||
} else if (grent->gr_name != NULL && grent->gr_name[0] != '\0') {
|
||||
cache->cache[slot].name = strdup(grent->gr_name);
|
||||
cache->cache[slot].id = gid;
|
||||
return (cache->cache[slot].name);
|
||||
}
|
||||
return (NULL);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue