From d4239808ee9dc891219fd589ec2b120b3c201a34 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Wed, 3 Jul 2019 02:49:27 +0200 Subject: [PATCH] renameatu: Fix test failure on MSVC. * lib/at-func2.c (at_func2): Fail with ENOENT if file1 or file2 is the empty string. --- ChangeLog | 6 ++++++ lib/at-func2.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index ea2e86a0da..d6209efafc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-07-03 Bruno Haible + + 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 mbrtowc: Fix invalid use of mbtowc() on MSVC. 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. */ -- 2.39.5