mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
If getpwent/getpwuid/getpwnam return NULL, they must also set errno.
This commit is contained in:
parent
6cd91141eb
commit
b4cc8687ad
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=129319
@ -379,6 +379,7 @@ getpw(int (*fn)(union key, struct passwd *, char *, size_t, struct passwd **),
|
||||
free(pwd_storage);
|
||||
if ((pwd_storage_size << 1) > PWD_STORAGE_MAX) {
|
||||
pwd_storage = NULL;
|
||||
errno = ERANGE;
|
||||
return (NULL);
|
||||
}
|
||||
pwd_storage_size <<= 1;
|
||||
@ -387,6 +388,8 @@ getpw(int (*fn)(union key, struct passwd *, char *, size_t, struct passwd **),
|
||||
return (NULL);
|
||||
}
|
||||
} while (res == NULL && rv == ERANGE);
|
||||
if (res == NULL)
|
||||
errno = rv;
|
||||
return (res);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user