From: Rich Felker Date: Wed, 20 Jun 2012 18:39:50 +0000 (-0400) Subject: make popen cancellation-safe X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=9c21f4342c787e04a9e31ad8a1d87a65c89968ca;ds=sidebyside 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. --- 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) {