summaryrefslogtreecommitdiff
path: root/lib/stdio--.h
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-08-19 10:02:19 -0600
committerEric Blake <ebb9@byu.net>2009-08-19 10:50:36 -0600
commitccb9c6798066958dd14c1005a7d5ffc1cbd6edae (patch)
tree90a0268c84a274c3e66d80dd311b6d85f15ab484 /lib/stdio--.h
parentfb8c836ade0d4ab8050c2c381795ce098b701115 (diff)
downloadgnulib-ccb9c6798066958dd14c1005a7d5ffc1cbd6edae.tar.gz
popen-safer: prevent popen from clobbering std descriptors
* modules/popen-safer: New file. * lib/popen-safer.c: Likewise. * m4/stdio-safer.m4 (gl_POPEN_SAFER): New macro. * lib/stdio--.h (popen): Provide override. * lib/stdio-safer.h (popen_safer): Provide declaration. * tests/test-popen.c (includes): Partially test this. * modules/popen-safer-tests: New file, for more tests. * tests/test-popen-safer.c: Likewise. * MODULES.html.sh (file stream based Input/Output): Mention it. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'lib/stdio--.h')
-rw-r--r--lib/stdio--.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/stdio--.h b/lib/stdio--.h
index eafbdb127b..ed90dda5a5 100644
--- a/lib/stdio--.h
+++ b/lib/stdio--.h
@@ -29,3 +29,8 @@
# undef tmpfile
# define tmpfile tmpfile_safer
#endif
+
+#if GNULIB_POPEN_SAFER
+# undef popen
+# define popen popen_safer
+#endif