diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-06-20 14:39:50 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-06-20 14:39:50 -0400 |
commit | 9c21f4342c787e04a9e31ad8a1d87a65c89968ca (patch) | |
tree | ec09299484f96dd61e6ebe84f37ceab69610a3f5 /src/stdio | |
parent | f305467aad4659e92fff84be6c89d4767b6f99d4 (diff) | |
download | musl-9c21f4342c787e04a9e31ad8a1d87a65c89968ca.tar.gz musl-9c21f4342c787e04a9e31ad8a1d87a65c89968ca.tar.bz2 musl-9c21f4342c787e04a9e31ad8a1d87a65c89968ca.tar.xz musl-9c21f4342c787e04a9e31ad8a1d87a65c89968ca.zip |
make popen cancellation-safe
close was the only cancellation point called from popen, but it left
popen with major resource leaks if any call to close got cancelled.
the easiest, cheapest fix is just to use a non-cancellable close
function.
Diffstat (limited to 'src/stdio')
-rw-r--r-- | src/stdio/popen.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/stdio/popen.c b/src/stdio/popen.c index 50765daa..4f9d6e9e 100644 --- a/src/stdio/popen.c +++ b/src/stdio/popen.c @@ -1,4 +1,11 @@ #include "stdio_impl.h" +#include "syscall.h" + +static inline void nc_close(int fd) +{ + __syscall(SYS_close, fd); +} +#define close(x) nc_close(x) FILE *popen(const char *cmd, const char *mode) { |