summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getpwent.3
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2004-05-17 18:27:05 +0000
committerkientzle <kientzle@FreeBSD.org>2004-05-17 18:27:05 +0000
commitd686b7f3d62f0fc8cdae311688c58ea962e5b15f (patch)
tree284e623c6ad0b15592f4ecb1a0f5f9461b587413 /lib/libc/gen/getpwent.3
parent83b77f88307324198de066d24fd029a853e8a75e (diff)
downloadFreeBSD-src-d686b7f3d62f0fc8cdae311688c58ea962e5b15f.zip
FreeBSD-src-d686b7f3d62f0fc8cdae311688c58ea962e5b15f.tar.gz
POSIX prohibits any library function from setting errno to 0.
Correct my previous commit and add a comment to the manpage indicating that the user must set errno to 0 if they wish to distinguish "no such user" from "error". Pointed out by: Jacques Vidrine (nectar@)
Diffstat (limited to 'lib/libc/gen/getpwent.3')
-rw-r--r--lib/libc/gen/getpwent.36
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/libc/gen/getpwent.3 b/lib/libc/gen/getpwent.3
index da1988c..8cb51a3 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 ,
OpenPOWER on IntegriCloud