diff options
| author | Tim Kientzle <kientzle@FreeBSD.org> | 2004-05-17 18:27:05 +0000 |
|---|---|---|
| committer | Tim Kientzle <kientzle@FreeBSD.org> | 2004-05-17 18:27:05 +0000 |
| commit | 5edb850fbe389e91cc694bc5ea44fb5843a2dad9 (patch) | |
| tree | 284e623c6ad0b15592f4ecb1a0f5f9461b587413 /lib/libc | |
| parent | 3030b19f2cdd8d8c3178b015565d91bc86e20848 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/gen/getpwent.3 | 6 | ||||
| -rw-r--r-- | lib/libc/gen/getpwent.c | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/gen/getpwent.3 b/lib/libc/gen/getpwent.3 index da1988cfbb8e..8cb51a3e0b63 100644 --- a/lib/libc/gen/getpwent.3 +++ b/lib/libc/gen/getpwent.3 @@ -185,9 +185,13 @@ return a valid pointer to a passwd structure on success or .Dv NULL if the entry is not found or if an error occurs. -In the latter case, +If an error does occur, .Va errno will be set. +Note that programs must explicitly set +.Va errno +to zero before calling any of these functions if they need to +distinguish between a non-existent entry and an error. The functions .Fn getpwent_r , .Fn getpwnam_r , diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 1753a83c8373..a0867ddf8e1c 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -388,7 +388,7 @@ getpw(int (*fn)(union key, struct passwd *, char *, size_t, struct passwd **), return (NULL); } } while (res == NULL && rv == ERANGE); - if (res == NULL) + if (rv != 0) errno = rv; return (res); } |
