From: Bruno Haible Date: Sat, 14 Sep 2019 11:10:22 +0000 (+0200) Subject: findprog-in: Better mimic the system on native Windows. X-Git-Tag: v1.0~4663 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=43fcc2ac704d94640abbfccc53b247243c33d6e0;p=thirdparty%2Fgnulib.git findprog-in: Better mimic the system on native Windows. Reported by Paul Smith . * lib/findprog-in.c (find_in_given_path): On native Windows, don't try non-empty suffixes when the file name already contains a '.'. --- diff --git a/ChangeLog b/ChangeLog index 2ef2c89215..d62a962847 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2019-09-14 Bruno Haible + + findprog-in: Better mimic the system on native Windows. + Reported by Paul Smith . + * lib/findprog-in.c (find_in_given_path): On native Windows, don't try + non-empty suffixes when the file name already contains a '.'. + 2019-09-10 Bruno Haible wctob: Fix autoconf test. diff --git a/lib/findprog-in.c b/lib/findprog-in.c index 99b3c314d9..d601e060d9 100644 --- a/lib/findprog-in.c +++ b/lib/findprog-in.c @@ -118,8 +118,9 @@ find_in_given_path (const char *progname, const char *path, const char *suffix = suffixes[i]; #if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */ - /* File names without a '.' are not considered executable. */ - if (*suffix != '\0' || strchr (progbasename, '.') != NULL) + /* File names without a '.' are not considered executable, and + for file names with a '.' no additional suffix is tried. */ + if ((*suffix != '\0') != (strchr (progbasename, '.') != NULL)) #endif { /* Concatenate progname and suffix. */ @@ -185,8 +186,9 @@ find_in_given_path (const char *progname, const char *path, const char *suffix = suffixes[i]; #if defined _WIN32 && !defined __CYGWIN__ /* Native Windows */ - /* File names without a '.' are not considered executable. */ - if (*suffix != '\0' || strchr (progname, '.') != NULL) + /* File names without a '.' are not considered executable, and + for file names with a '.' no additional suffix is tried. */ + if ((*suffix != '\0') != (strchr (progname, '.') != NULL)) #endif { /* Concatenate dir, progname, and suffix. */