freopen: Don't crash if the filename argument is NULL.
[gnulib.git] / lib / freopen.c
index c763365..bae0646 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