summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorguenther <>2014-09-15 06:15:48 +0000
committerguenther <>2014-09-15 06:15:48 +0000
commit6fa5c415aa0acdbeb8a8b9beba390518489304ab (patch)
treead712f134771158fecd87a78b6c147ee2b1a2261 /src
parent942d3f7f21b3d5906968b93cbb26de97a8979084 (diff)
downloadopenbsd-6fa5c415aa0acdbeb8a8b9beba390518489304ab.tar.gz
openbsd-6fa5c415aa0acdbeb8a8b9beba390518489304ab.tar.bz2
openbsd-6fa5c415aa0acdbeb8a8b9beba390518489304ab.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 'src')
-rw-r--r--src/lib/libc/net/ethers.c6
-rw-r--r--src/lib/libc/net/getnetent.c6
-rw-r--r--src/lib/libc/net/getprotoent.c6
-rw-r--r--src/lib/libc/net/getservent.c6
-rw-r--r--src/lib/libc/net/ruserok.c4
5 files changed, 14 insertions, 14 deletions
diff --git a/src/lib/libc/net/ethers.c b/src/lib/libc/net/ethers.c
index af31bb8e60..07f1da3306 100644
--- a/src/lib/libc/net/ethers.c
+++ b/src/lib/libc/net/ethers.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ethers.c,v 1.21 2013/11/24 23:51:28 deraadt Exp $ */ 1/* $OpenBSD: ethers.c,v 1.22 2014/09/15 06:15:48 guenther Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4 * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -112,7 +112,7 @@ ether_ntohost(char *hostname, struct ether_addr *e)
112 trylen = strlen(trybuf); 112 trylen = strlen(trybuf);
113#endif 113#endif
114 114
115 f = fopen(_PATH_ETHERS, "r"); 115 f = fopen(_PATH_ETHERS, "re");
116 if (f == NULL) 116 if (f == NULL)
117 return (-1); 117 return (-1);
118 while ((p = fgetln(f, &len)) != NULL) { 118 while ((p = fgetln(f, &len)) != NULL) {
@@ -165,7 +165,7 @@ ether_hostton(const char *hostname, struct ether_addr *e)
165 int hostlen = strlen(hostname); 165 int hostlen = strlen(hostname);
166#endif 166#endif
167 167
168 f = fopen(_PATH_ETHERS, "r"); 168 f = fopen(_PATH_ETHERS, "re");
169 if (f==NULL) 169 if (f==NULL)
170 return (-1); 170 return (-1);
171 171
diff --git a/src/lib/libc/net/getnetent.c b/src/lib/libc/net/getnetent.c
index 57fe459e2b..14c39f1482 100644
--- a/src/lib/libc/net/getnetent.c
+++ b/src/lib/libc/net/getnetent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getnetent.c,v 1.13 2012/04/10 16:41:10 eric Exp $ */ 1/* $OpenBSD: getnetent.c,v 1.14 2014/09/15 06:15:48 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1983, 1993 3 * Copyright (c) 1983, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -48,7 +48,7 @@ void
48setnetent(int f) 48setnetent(int f)
49{ 49{
50 if (netf == NULL) 50 if (netf == NULL)
51 netf = fopen(_PATH_NETWORKS, "r" ); 51 netf = fopen(_PATH_NETWORKS, "re" );
52 else 52 else
53 rewind(netf); 53 rewind(netf);
54 _net_stayopen |= f; 54 _net_stayopen |= f;
@@ -70,7 +70,7 @@ getnetent(void)
70 char *p, *cp, **q; 70 char *p, *cp, **q;
71 size_t len; 71 size_t len;
72 72
73 if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "r" )) == NULL) 73 if (netf == NULL && (netf = fopen(_PATH_NETWORKS, "re" )) == NULL)
74 return (NULL); 74 return (NULL);
75again: 75again:
76 if ((p = fgetln(netf, &len)) == NULL) 76 if ((p = fgetln(netf, &len)) == NULL)
diff --git a/src/lib/libc/net/getprotoent.c b/src/lib/libc/net/getprotoent.c
index f0705e0765..87060b7b3c 100644
--- a/src/lib/libc/net/getprotoent.c
+++ b/src/lib/libc/net/getprotoent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getprotoent.c,v 1.10 2007/09/02 15:19:17 deraadt Exp $ */ 1/* $OpenBSD: getprotoent.c,v 1.11 2014/09/15 06:15:48 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1983, 1993 3 * Copyright (c) 1983, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -42,7 +42,7 @@ void
42setprotoent_r(int f, struct protoent_data *pd) 42setprotoent_r(int f, struct protoent_data *pd)
43{ 43{
44 if (pd->fp == NULL) 44 if (pd->fp == NULL)
45 pd->fp = fopen(_PATH_PROTOCOLS, "r" ); 45 pd->fp = fopen(_PATH_PROTOCOLS, "re" );
46 else 46 else
47 rewind(pd->fp); 47 rewind(pd->fp);
48 pd->stayopen |= f; 48 pd->stayopen |= f;
@@ -71,7 +71,7 @@ getprotoent_r(struct protoent *pe, struct protoent_data *pd)
71 long l; 71 long l;
72 int serrno; 72 int serrno;
73 73
74 if (pd->fp == NULL && (pd->fp = fopen(_PATH_PROTOCOLS, "r" )) == NULL) 74 if (pd->fp == NULL && (pd->fp = fopen(_PATH_PROTOCOLS, "re" )) == NULL)
75 return (-1); 75 return (-1);
76again: 76again:
77 if ((p = fgetln(pd->fp, &len)) == NULL) 77 if ((p = fgetln(pd->fp, &len)) == NULL)
diff --git a/src/lib/libc/net/getservent.c b/src/lib/libc/net/getservent.c
index c81a4cf3e2..7e3293389d 100644
--- a/src/lib/libc/net/getservent.c
+++ b/src/lib/libc/net/getservent.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getservent.c,v 1.12 2007/09/02 15:19:17 deraadt Exp $ */ 1/* $OpenBSD: getservent.c,v 1.13 2014/09/15 06:15:48 guenther Exp $ */
2/* 2/*
3 * Copyright (c) 1983, 1993 3 * Copyright (c) 1983, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -42,7 +42,7 @@ void
42setservent_r(int f, struct servent_data *sd) 42setservent_r(int f, struct servent_data *sd)
43{ 43{
44 if (sd->fp == NULL) 44 if (sd->fp == NULL)
45 sd->fp = fopen(_PATH_SERVICES, "r" ); 45 sd->fp = fopen(_PATH_SERVICES, "re" );
46 else 46 else
47 rewind(sd->fp); 47 rewind(sd->fp);
48 sd->stayopen |= f; 48 sd->stayopen |= f;
@@ -71,7 +71,7 @@ getservent_r(struct servent *se, struct servent_data *sd)
71 long l; 71 long l;
72 int serrno; 72 int serrno;
73 73
74 if (sd->fp == NULL && (sd->fp = fopen(_PATH_SERVICES, "r" )) == NULL) 74 if (sd->fp == NULL && (sd->fp = fopen(_PATH_SERVICES, "re" )) == NULL)
75 return (-1); 75 return (-1);
76again: 76again:
77 if ((p = fgetln(sd->fp, &len)) == NULL) 77 if ((p = fgetln(sd->fp, &len)) == NULL)
diff --git a/src/lib/libc/net/ruserok.c b/src/lib/libc/net/ruserok.c
index 21646c156b..4d0adfbe4e 100644
--- a/src/lib/libc/net/ruserok.c
+++ b/src/lib/libc/net/ruserok.c
@@ -118,7 +118,7 @@ iruserok_sa(const void *raddr, int rlen, int superuser, const char *ruser,
118 118
119 sa = (struct sockaddr *)raddr; 119 sa = (struct sockaddr *)raddr;
120 first = 1; 120 first = 1;
121 hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r"); 121 hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "re");
122again: 122again:
123 if (hostf) { 123 if (hostf) {
124 if (__ivaliduser_sa(hostf, sa, rlen, luser, ruser) == 0) { 124 if (__ivaliduser_sa(hostf, sa, rlen, luser, ruser) == 0) {
@@ -144,7 +144,7 @@ again:
144 */ 144 */
145 uid = geteuid(); 145 uid = geteuid();
146 (void)seteuid(pwd->pw_uid); 146 (void)seteuid(pwd->pw_uid);
147 hostf = fopen(pbuf, "r"); 147 hostf = fopen(pbuf, "re");
148 (void)seteuid(uid); 148 (void)seteuid(uid);
149 149
150 if (hostf == NULL) 150 if (hostf == NULL)