From 8582a6e9f25dd7b87d72961f58008052a4cac473 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 29 Sep 2012 18:09:34 -0400 Subject: add 'e' modifier (close-on-exec) to fopen and fdopen this feature will be in the next version of POSIX, and can be used internally immediately. there are many internal uses of fopen where close-on-exec is needed to fix bugs. --- src/stdio/fopen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/stdio/fopen.c') diff --git a/src/stdio/fopen.c b/src/stdio/fopen.c index 560b77e4..03c10cd1 100644 --- a/src/stdio/fopen.c +++ b/src/stdio/fopen.c @@ -17,6 +17,7 @@ FILE *fopen(const char *restrict filename, const char *restrict mode) else if (*mode == 'r') flags = O_RDONLY; else flags = O_WRONLY; if (strchr(mode, 'x')) flags |= O_EXCL; + if (strchr(mode, 'e')) flags |= O_CLOEXEC; if (*mode != 'r') flags |= O_CREAT; if (*mode == 'w') flags |= O_TRUNC; if (*mode == 'a') flags |= O_APPEND; -- cgit v1.2.1