]> 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>
Thu, 1 Sep 2022 12:03:42 +0000 (14:03 +0200)
* lib/supersede.c (open_supersede): On native Windows, map "/dev/null"
to "NUL".

ChangeLog
lib/supersede.c

index 5ff33c410c457b8919ae5114937817582f64a809..ae9e8de4eb6bd638cf8f05769bf0592cfd0bbd9a 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 6207286980c4cf9d91fd2ac4e7096e7ed88acc68..a72c4f40e83ae30f56984271d95df60eb60b3163 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)