summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-07-03 02:49:27 +0200
committerBruno Haible <bruno@clisp.org>2019-07-06 00:31:51 +0200
commitd4239808ee9dc891219fd589ec2b120b3c201a34 (patch)
treede929df878286b991248b8d416b00821d2d3f276
parent9ce9be2ef0cb1180e35dfe9dfbbe90d774b374bd (diff)
downloadgnulib-d4239808ee9dc891219fd589ec2b120b3c201a34.tar.gz
renameatu: Fix test failure on MSVC.
* lib/at-func2.c (at_func2): Fail with ENOENT if file1 or file2 is the empty string.
-rw-r--r--ChangeLog6
-rw-r--r--lib/at-func2.c7
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ea2e86a0da..d6209efafc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
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.
* lib/mbrtowc.c: Include glthread/lock.h.
(mbtowc_lock): New variable.
diff --git a/lib/at-func2.c b/lib/at-func2.c
index eaa256cb1e..bb8792f6e1 100644
--- a/lib/at-func2.c
+++ b/lib/at-func2.c
@@ -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. */