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 7a545c696c3a0c3edd5c404b5fab6321b75b5629..b5d16e6449d3dbb147c27ccefadeead7739a276a 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 39fca29200c3ff64be4fcef45a6857ee35f67ce8..eafbdb127b6db9fb69dc807140fbc76f2039aa65 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 253b76b4477d61a99d37389bdf4b61b4759987a7..b9da4660834a4834dde735744493443ca838be3a 100644 (file)
@@ -10,6 +10,7 @@ m4/fcntl-safer.m4
 m4/mode_t.m4
 
 Depends-on:
+fcntl
 open
 unistd-safer
 
index 087e045c2c7dbbba5747bee976d878160570802f..6a68f0cde62f1ace234bdf44555534084b7d697e 100644 (file)
@@ -8,6 +8,7 @@ lib/fopen-safer.c
 m4/stdio-safer.m4
 
 Depends-on:
+fopen
 unistd-safer
 
 configure.ac:
index 8f7cb3f00053faaf214c0cb9f28ff97831e96914..ddeb865ac65bc054fe4c6970fc79943672395f76 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 c81906332fceb78c072a0a17e9e2dc095c890968..de615442ee66ff2f61b15c4b79c186be8aee398d 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 86e23abe03fadbbedcc0ae7671c059fce4857169..e2182fd142fc596d5c79c4d936b1dc110fe065b6 100644 (file)
@@ -14,6 +14,7 @@ unistd
 
 configure.ac:
 gl_UNISTD_SAFER
+gl_MODULE_INDICATOR([unistd-safer])
 
 Makefile.am:
 
index 337a389194f6b3e63a879ac5278cbdfca39631a5..b9e3694071e248f86304f55e34300ff621c1c98c 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 f7bb54360adc58e4bd251d98ca7ecb2ff5efa7ec..c9f3641c3526d8f1a4af0db411654c4d27e4e7b9 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 
+#if GNULIB_FCNTL_SAFER
+# include "fcntl--.h"
+#endif
+
 #define ASSERT(expr) \
   do                                                                        \
     {                                                                       \