projects
/
musl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
f305467
)
make popen cancellation-safe
author
Rich Felker
<dalias@aerifal.cx>
Wed, 20 Jun 2012 18:39:50 +0000
(14:39 -0400)
committer
Rich Felker
<dalias@aerifal.cx>
Wed, 20 Jun 2012 18:39:50 +0000
(14:39 -0400)
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
patch
|
blob
|
history
diff --git
a/src/stdio/popen.c
b/src/stdio/popen.c
index
50765da
..
4f9d6e9
100644
(file)
--- 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)
{