summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-16 07:10:33 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1998-11-16 07:10:33 +0000
commitd013ca14bd91d9c45daf2f260b7de58ff0b84f63 (patch)
tree5cf193b4ade151dac1035675caadbcf24f0e2d3b /lib
parent013ce23c0646befd280c7c1bf5295d3412fcb79d (diff)
preserve errno; christos
Diffstat (limited to 'lib')
-rw-r--r--lib/libutil/passwd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index c15d6e94754..456f878cc99 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.19 1998/08/03 17:16:32 millert Exp $ */
+/* $OpenBSD: passwd.c,v 1.20 1998/11/16 07:10:32 deraadt Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: passwd.c,v 1.19 1998/08/03 17:16:32 millert Exp $";
+static char rcsid[] = "$OpenBSD: passwd.c,v 1.20 1998/11/16 07:10:32 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -251,6 +251,7 @@ pw_lock(retries)
{
int i, fd;
mode_t old_mode;
+ int save_errno;
if (!pw_lck)
return (-1);
@@ -261,7 +262,9 @@ pw_lock(retries)
sleep(1);
fd = open(pw_lck, O_WRONLY|O_CREAT|O_EXCL, 0600);
}
- umask(old_mode);
+ save_errno = errno;
+ (void) umask(old_mode);
+ errno = save_errno;
return (fd);
}