tests: test some of the *-safer modules
authorEric Blake <ebb9@byu.net>
Wed, 19 Aug 2009 15:54:54 +0000 (09:54 -0600)
committerEric Blake <ebb9@byu.net>
Wed, 19 Aug 2009 16:12:14 +0000 (10:12 -0600)
* 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 <ebb9@byu.net>
ChangeLog
lib/stdio--.h
modules/fcntl-safer
modules/fopen-safer
modules/stdlib-safer
modules/tmpfile-safer
modules/unistd-safer
tests/test-fopen.c
tests/test-open.c

index 7a545c6..b5d16e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2009-08-19  Eric Blake  <ebb9@byu.net>
 
+       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.
index 39fca29..eafbdb1 100644 (file)
@@ -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
 #include <stdio.h>
 #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
index 253b76b..b9da466 100644 (file)
@@ -10,6 +10,7 @@ m4/fcntl-safer.m4
 m4/mode_t.m4
 
 Depends-on:
+fcntl
 open
 unistd-safer
 
index 087e045..6a68f0c 100644 (file)
@@ -8,6 +8,7 @@ lib/fopen-safer.c
 m4/stdio-safer.m4
 
 Depends-on:
+fopen
 unistd-safer
 
 configure.ac:
index 8f7cb3f..ddeb865 100644 (file)
@@ -9,10 +9,12 @@ m4/stdlib-safer.m4
 
 Depends-on:
 mkstemp
+stdlib
 unistd-safer
 
 configure.ac:
 gl_STDLIB_SAFER
+gl_MODULE_INDICATOR([stdlib-safer])
 
 Makefile.am:
 
index c819063..de61544 100644 (file)
@@ -9,10 +9,12 @@ m4/stdio-safer.m4
 
 Depends-on:
 binary-io
+tmpfile
 unistd-safer
 
 configure.ac:
 gl_TMPFILE_SAFER
+gl_MODULE_INDICATOR([tmpfile-safer])
 
 Makefile.am:
 
index 86e23ab..e2182fd 100644 (file)
@@ -14,6 +14,7 @@ unistd
 
 configure.ac:
 gl_UNISTD_SAFER
+gl_MODULE_INDICATOR([unistd-safer])
 
 Makefile.am:
 
index 337a389..b9e3694 100644 (file)
@@ -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
 #include <stdio.h>
 #include <stdlib.h>
 
+#if GNULIB_FOPEN_SAFER
+# include "stdio--.h"
+#endif
+
 #define ASSERT(expr) \
   do                                                                        \
     {                                                                       \
index f7bb543..c9f3641 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
+#if GNULIB_FCNTL_SAFER
+# include "fcntl--.h"
+#endif
+
 #define ASSERT(expr) \
   do                                                                        \
     {                                                                       \