# HG changeset patch # User Eric Blake # Date 1250697294 21600 # Node ID 18b5c404aa0487b83f9e58499bf3ceb5c5576ac2 # Parent 9e3299dad578f686559296dd941bfd3db74ddf0d tests: test some of the *-safer modules * modules/fopen-safer (Depends-on): Add fopen. * modules/fcntl-safer (Depends-on): Add fcntl. * modules/stdlib-safer (Depends-on): Add stdlib. (configure.ac): Set indicator. * modules/unistd-safer (configure.ac): Likewise. * modules/tmpfile-safer (configure.ac): Likewise. (Depends-on): Add tmpfile. * lib/stdio--.h (fopen, tmpfile): Don't override unless module is active. * tests/test-fopen.c (includes): Test safer versions when they are in use. * tests/test-open.c (includes): Likewise. Signed-off-by: Eric Blake diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2009-08-19 Eric Blake + tests: test some of the *-safer modules + * modules/fopen-safer (Depends-on): Add fopen. + * modules/fcntl-safer (Depends-on): Add fcntl. + * modules/stdlib-safer (Depends-on): Add stdlib. + (configure.ac): Set indicator. + * modules/unistd-safer (configure.ac): Likewise. + * modules/tmpfile-safer (configure.ac): Likewise. + (Depends-on): Add tmpfile. + * lib/stdio--.h (fopen, tmpfile): Don't override unless module is + active. + * tests/test-fopen.c (includes): Test safer versions when they are + in use. + * tests/test-open.c (includes): Likewise. + popen: fix cygwin 1.5 bug when stdin closed * doc/posix-functions/popen.texi (popen): Document cygwin bugs. * modules/popen: New file. diff --git a/lib/stdio--.h b/lib/stdio--.h --- a/lib/stdio--.h +++ b/lib/stdio--.h @@ -1,6 +1,6 @@ /* Like stdio.h, but redefine some names to avoid glitches. - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,8 +20,12 @@ #include #include "stdio-safer.h" -#undef fopen -#define fopen fopen_safer +#if GNULIB_FOPEN_SAFER +# undef fopen +# define fopen fopen_safer +#endif -#undef tmpfile -#define tmpfile tmpfile_safer +#if GNULIB_TMPFILE_SAFER +# undef tmpfile +# define tmpfile tmpfile_safer +#endif diff --git a/modules/fcntl-safer b/modules/fcntl-safer --- a/modules/fcntl-safer +++ b/modules/fcntl-safer @@ -10,6 +10,7 @@ m4/mode_t.m4 Depends-on: +fcntl open unistd-safer diff --git a/modules/fopen-safer b/modules/fopen-safer --- a/modules/fopen-safer +++ b/modules/fopen-safer @@ -8,6 +8,7 @@ m4/stdio-safer.m4 Depends-on: +fopen unistd-safer configure.ac: diff --git a/modules/stdlib-safer b/modules/stdlib-safer --- a/modules/stdlib-safer +++ b/modules/stdlib-safer @@ -9,10 +9,12 @@ Depends-on: mkstemp +stdlib unistd-safer configure.ac: gl_STDLIB_SAFER +gl_MODULE_INDICATOR([stdlib-safer]) Makefile.am: diff --git a/modules/tmpfile-safer b/modules/tmpfile-safer --- a/modules/tmpfile-safer +++ b/modules/tmpfile-safer @@ -9,10 +9,12 @@ Depends-on: binary-io +tmpfile unistd-safer configure.ac: gl_TMPFILE_SAFER +gl_MODULE_INDICATOR([tmpfile-safer]) Makefile.am: diff --git a/modules/unistd-safer b/modules/unistd-safer --- a/modules/unistd-safer +++ b/modules/unistd-safer @@ -14,6 +14,7 @@ configure.ac: gl_UNISTD_SAFER +gl_MODULE_INDICATOR([unistd-safer]) Makefile.am: diff --git a/tests/test-fopen.c b/tests/test-fopen.c --- a/tests/test-fopen.c +++ b/tests/test-fopen.c @@ -1,5 +1,5 @@ /* Test of opening a file stream. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,6 +21,10 @@ #include #include +#if GNULIB_FOPEN_SAFER +# include "stdio--.h" +#endif + #define ASSERT(expr) \ do \ { \ diff --git a/tests/test-open.c b/tests/test-open.c --- a/tests/test-open.c +++ b/tests/test-open.c @@ -23,6 +23,10 @@ #include #include +#if GNULIB_FCNTL_SAFER +# include "fcntl--.h" +#endif + #define ASSERT(expr) \ do \ { \