summaryrefslogtreecommitdiff
path: root/src/passwd/getspnam_r.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-09-29 18:14:46 -0400
committerRich Felker <dalias@aerifal.cx>2012-09-29 18:14:46 -0400
commitd712dd396d7d69686f7001fd986bfc59217b72dd (patch)
tree97fa1f57688e106fb0fe94c27b6d7484b8720db5 /src/passwd/getspnam_r.c
parent8582a6e9f25dd7b87d72961f58008052a4cac473 (diff)
downloadmusl-d712dd396d7d69686f7001fd986bfc59217b72dd.tar.gz
more close-on-exec fixes, mostly using new "e" flag to fopen
Diffstat (limited to 'src/passwd/getspnam_r.c')
-rw-r--r--src/passwd/getspnam_r.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/passwd/getspnam_r.c b/src/passwd/getspnam_r.c
index 9f3378e9..f4d7b35e 100644
--- a/src/passwd/getspnam_r.c
+++ b/src/passwd/getspnam_r.c
@@ -46,7 +46,7 @@ int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)
return EINVAL;
- fd = open(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK);
+ fd = open(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK|O_CLOEXEC);
if (fd >= 0) {
struct stat st = { 0 };
errno = EINVAL;
@@ -57,7 +57,7 @@ int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
return errno;
}
} else {
- f = fopen("/etc/shadow", "rb");
+ f = fopen("/etc/shadow", "rbe");
if (!f) return errno;
}