mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 06:52:45 +00:00
Compatibility fix for some older systems with non-POSIX getgrnam_r/getpwnam_r
and a minor style fix for the hash function.
This commit is contained in:
parent
94cb976997
commit
96de948146
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201083
@ -125,6 +125,7 @@ lookup_gid(void *private_data, const char *gname, gid_t gid)
|
||||
int r;
|
||||
|
||||
for (;;) {
|
||||
result = &grent; /* Old getgrnam_r ignores last arg. */
|
||||
r = getgrnam_r(gname, &grent, buffer, bufsize, &result);
|
||||
if (r == 0)
|
||||
break;
|
||||
@ -184,6 +185,7 @@ lookup_uid(void *private_data, const char *uname, uid_t uid)
|
||||
int r;
|
||||
|
||||
for (;;) {
|
||||
result = &pwent; /* Old getpwnam_r ignores last arg. */
|
||||
r = getpwnam_r(uname, &pwent, buffer, bufsize, &result);
|
||||
if (r == 0)
|
||||
break;
|
||||
@ -230,8 +232,8 @@ hash(const char *p)
|
||||
as used by ELF for hashing function names. */
|
||||
unsigned g, h = 0;
|
||||
while (*p != '\0') {
|
||||
h = ( h << 4 ) + *p++;
|
||||
if (( g = h & 0xF0000000 )) {
|
||||
h = (h << 4) + *p++;
|
||||
if ((g = h & 0xF0000000) != 0) {
|
||||
h ^= g >> 24;
|
||||
h &= 0x0FFFFFFF;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user