summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/getgrent.c8
-rw-r--r--lib/libc/gen/getgrouplist.c8
-rw-r--r--lib/libc/gen/getpwent.c3
3 files changed, 16 insertions, 3 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 09cb973a075..ab5544f24f1 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getgrent.c,v 1.47 2018/09/13 12:31:15 millert Exp $ */
+/* $OpenBSD: getgrent.c,v 1.48 2019/07/02 15:54:05 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -197,6 +197,10 @@ DEF_WEAK(getgrgid_r);
static int
start_gr(void)
{
+#ifdef YP
+ int saved_errno = errno;
+#endif
+
if (_gr_fp) {
rewind(_gr_fp);
#ifdef YP
@@ -214,7 +218,9 @@ start_gr(void)
/*
* Hint to the kernel that a passwd database operation is happening.
*/
+ saved_errno = errno;
(void)access("/var/run/ypbind.lock", R_OK);
+ errno = saved_errno;
#endif
return((_gr_fp = fopen(_PATH_GROUP, "re")) ? 1 : 0);
diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c
index e347ffcec90..d0701dffb17 100644
--- a/lib/libc/gen/getgrouplist.c
+++ b/lib/libc/gen/getgrouplist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getgrouplist.c,v 1.27 2015/12/01 15:08:25 deraadt Exp $ */
+/* $OpenBSD: getgrouplist.c,v 1.28 2019/07/02 15:54:05 deraadt Exp $ */
/*
* Copyright (c) 2008 Ingo Schwarze <schwarze@usta.de>
* Copyright (c) 1991, 1993
@@ -40,6 +40,7 @@
#include <stdlib.h>
#include <grp.h>
#include <pwd.h>
+#include <errno.h>
#include <rpc/rpc.h>
#include <rpcsvc/yp.h>
@@ -148,6 +149,9 @@ getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt)
int *skipyp = &foundyp;
extern struct group *_getgrent_yp(int *);
struct group *grp;
+#ifdef YP
+ int saved_errno;
+#endif
/*
* install primary group
@@ -162,7 +166,9 @@ getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt)
/*
* Hint to the kernel that a passwd database operation is happening.
*/
+ saved_errno = errno;
(void)access("/var/run/ypbind.lock", R_OK);
+ errno = saved_errno;
#endif
/*
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index db90e140e53..78039999f6e 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getpwent.c,v 1.62 2018/08/21 20:20:04 millert Exp $ */
+/* $OpenBSD: getpwent.c,v 1.63 2019/07/02 15:54:05 deraadt Exp $ */
/*
* Copyright (c) 2008 Theo de Raadt
* Copyright (c) 1988, 1993
@@ -981,6 +981,7 @@ __initdb(int shadow)
* Hint to the kernel that a passwd database operation is happening.
*/
(void)access("/var/run/ypbind.lock", R_OK);
+ errno = saved_errno;
__ypmode = YPMODE_NONE;
__getpwent_has_yppw = -1;