]> Savannah Git Hosting - gnulib.git/commitdiff
renameatu: Fix test failure on MSVC.
authorBruno Haible <bruno@clisp.org>
Wed, 3 Jul 2019 00:49:27 +0000 (02:49 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 5 Jul 2019 22:31:51 +0000 (00:31 +0200)
* lib/at-func2.c (at_func2): Fail with ENOENT if file1 or file2 is the
empty string.

ChangeLog
lib/at-func2.c

index ea2e86a0dab42281064a4ffcc06de0e1907db8a3..d6209efafc970f62baa9993786204b0ba5b28276 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-07-03  Bruno Haible  <bruno@clisp.org>
+
+       renameatu: Fix test failure on MSVC.
+       * lib/at-func2.c (at_func2): Fail with ENOENT if file1 or file2 is the
+       empty string.
+
 2019-07-03  Bruno Haible  <bruno@clisp.org>
 
        mbrtowc: Fix invalid use of mbtowc() on MSVC.
index eaa256cb1e646006531e7b74730c2b546bf651a2..bb8792f6e108e954208728fa44ef4d62a2828c60 100644 (file)
@@ -176,6 +176,13 @@ at_func2 (int fd1, char const *file1,
         return func (file1, file2); /* Reduced to case 5.  */
     }
 
+  /* Catch invalid arguments before changing directories.  */
+  if (file1[0] == '\0' || file2[0] == '\0')
+    {
+      errno = ENOENT;
+      return -1;
+    }
+
   /* Cases 3, 7, 12, 13, 15a, 15b remain.  With all reductions in
      place, it is time to start changing directories.  */