diff options
author | Ray Lai <ray@cvs.openbsd.org> | 2006-12-17 20:50:52 +0000 |
---|---|---|
committer | Ray Lai <ray@cvs.openbsd.org> | 2006-12-17 20:50:52 +0000 |
commit | a1ff8a914da85448d7278b5679a2e6d88f8856a6 (patch) | |
tree | f917f86ec77bfb391367c3b08b2edb4ab3e9a33b /lib/libutil/passwd.c | |
parent | 5fc9be94a0cbfe07bf5b8fbbef13e79c5ce9714c (diff) |
Always write errno on pw_lock failure so it can be relied on.
Mention errno, pw_file, and pw_init in pw_lock man page.
OK jmc@, otto@, millert@, and deraadt@.
Diffstat (limited to 'lib/libutil/passwd.c')
-rw-r--r-- | lib/libutil/passwd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c index c3dc4ece8bf..94703156aed 100644 --- a/lib/libutil/passwd.c +++ b/lib/libutil/passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: passwd.c,v 1.47 2006/04/02 02:10:35 deraadt Exp $ */ +/* $OpenBSD: passwd.c,v 1.48 2006/12/17 20:50:51 ray Exp $ */ /* * Copyright (c) 1987, 1993, 1994, 1995 @@ -95,8 +95,10 @@ pw_lock(int retries) mode_t old_mode; int save_errno; - if (!pw_lck) + if (!pw_lck) { + errno = EINVAL; return (-1); + } /* Acquire the lock file. */ old_mode = umask(0); fd = open(pw_lck, O_WRONLY|O_CREAT|O_EXCL, 0600); |