summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getcap.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-09-15 06:15:48 +0000
committerguenther <guenther@openbsd.org>2014-09-15 06:15:48 +0000
commit241db05998f1091df691c528a16b6ca3ab8719d3 (patch)
tree3f038d1b6f858c1d54403aea4e05196b78947f43 /lib/libc/gen/getcap.c
parentPass O_CLOEXEC to open() or mkostemp() instead of setting FD_CLOEXEC afterwards (diff)
downloadwireguard-openbsd-241db05998f1091df691c528a16b6ca3ab8719d3.tar.xz
wireguard-openbsd-241db05998f1091df691c528a16b6ca3ab8719d3.zip
When fopen()ing internal to libc (the API doesn't support the use
of the resulting FILE *), then pass fopen() the 'e' mode letter to mark it close-on-exec. ok miod@
Diffstat (limited to 'lib/libc/gen/getcap.c')
-rw-r--r--lib/libc/gen/getcap.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c
index b2d0d616cd3..797ddb0cecd 100644
--- a/lib/libc/gen/getcap.c
+++ b/lib/libc/gen/getcap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getcap.c,v 1.30 2011/10/14 16:33:53 millert Exp $ */
+/* $OpenBSD: getcap.c,v 1.31 2014/09/15 06:15:48 guenther Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -272,7 +272,7 @@ getent(char **cap, u_int *len, char **db_array, FILE *fp,
*cap = cbuf;
return (retval);
} else {
- fp = fopen(*db_p, "r");
+ fp = fopen(*db_p, "re");
if (fp == NULL) {
/* No error on unfound file. */
continue;
@@ -670,7 +670,7 @@ cgetnext(char **cap, char **db_array)
if (dbp == NULL)
dbp = db_array;
- if (pfp == NULL && (pfp = fopen(*dbp, "r")) == NULL)
+ if (pfp == NULL && (pfp = fopen(*dbp, "re")) == NULL)
goto done;
/*
@@ -722,7 +722,7 @@ cgetnext(char **cap, char **db_array)
status = 0;
goto done;
} else if ((pfp =
- fopen(*dbp, "r")) == NULL) {
+ fopen(*dbp, "re")) == NULL) {
goto done;
} else
continue;