diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-05-17 06:17:59 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-05-17 06:17:59 +0000 |
commit | fe9e4fabe144d2919c6a4c9e9fa88bccfa7334d8 (patch) | |
tree | bca83a1443f9f6d55cedd65e53f3e923cefd1895 /lib/libc/gen | |
parent | b228036732d317d4744d4a6c4672a2f8ac695ce5 (diff) | |
download | FreeBSD-src-fe9e4fabe144d2919c6a4c9e9fa88bccfa7334d8.zip FreeBSD-src-fe9e4fabe144d2919c6a4c9e9fa88bccfa7334d8.tar.gz |
If getpwent/getpwuid/getpwnam return NULL, they must also set errno.
Diffstat (limited to 'lib/libc/gen')
-rw-r--r-- | lib/libc/gen/getpwent.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 96aee2e..1753a83 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -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); } |