]> Savannah Git Hosting - gnulib.git/commitdiff
freopen: Don't crash if the filename argument is NULL.
authorClaudio Bley <claudio.bley@gmail.com>
Wed, 31 Aug 2011 08:12:25 +0000 (10:12 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Aug 2011 08:12:57 +0000 (10:12 +0200)
* lib/freopen.c (rpl_freopen): Don't compare the filename if it is
NULL.

ChangeLog
lib/freopen.c

index ee56aa9a2f493075316a03cc5bef9d9a52959b3b..d06bcede5bb2455bf439de3fa12443b466ccaa91 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-31  Claudio Bley  <claudio.bley@gmail.com>  (tiny change)
+
+       freopen: Don't crash if the filename argument is NULL.
+       * lib/freopen.c (rpl_freopen): Don't compare the filename if it is
+       NULL.
+
 2011-08-30  Paul Eggert  <eggert@cs.ucla.edu>
 
        openat: work around AIX 7.1 fstatat bug
index c76336580d9fa6721645f3a7876fdf15f2b2bdc6..bae06468401222fb9e7c1c3ee07cd7b1ffbe8e6b 100644 (file)
@@ -41,7 +41,7 @@ FILE *
 rpl_freopen (const char *filename, const char *mode, FILE *stream)
 {
 #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-  if (strcmp (filename, "/dev/null") == 0)
+  if (filename != NULL && strcmp (filename, "/dev/null") == 0)
     filename = "NUL";
 #endif