From 9c21f4342c787e04a9e31ad8a1d87a65c89968ca Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 20 Jun 2012 14:39:50 -0400 Subject: 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. --- src/stdio/popen.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') 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) { -- cgit v1.2.3-70-g09d2