]> Savannah Git Hosting - gnulib.git/commitdiff
supersede: Support the file name "/dev/null" on native Windows.
authorBruno Haible <bruno@clisp.org>
Sun, 3 Jul 2022 09:58:03 +0000 (11:58 +0200)
committerBruno Haible <bruno@clisp.org>
Wed, 31 Aug 2022 23:15:46 +0000 (01:15 +0200)
* lib/supersede.c (open_supersede): On native Windows, map "/dev/null"
to "NUL".

ChangeLog
lib/supersede.c

index a5b6552d0a974b2a62056d8b207b99432030899f..a575aba47806347700067ce7cb1163c6a3139e17 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-07-03  Bruno Haible  <bruno@clisp.org>
+
+       supersede: Support the file name "/dev/null" on native Windows.
+       * lib/supersede.c (open_supersede): On native Windows, map "/dev/null"
+       to "NUL".
+
 2022-06-23  Jim Meyering  <meyering@fb.com>
 
        maint.mk: fix syntax-check for unnecessary hash.h header use
index 45b90829b2a613e21a72186df85fe06709e962b3..898c565ade2990b4e4e056c560434109fc283287 100644 (file)
@@ -93,6 +93,11 @@ open_supersede (const char *filename, int flags, mode_t mode,
     0;
     #endif
 
+#if defined _WIN32 && ! defined __CYGWIN__
+  if (strcmp (filename, "/dev/null") == 0)
+    filename = "NUL";
+#endif
+
   if (supersede_if_exists)
     {
       if (supersede_if_does_not_exist)