]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
findprog-in: Better mimic the system on native Windows.
authorBruno Haible <bruno@clisp.org>
Sat, 14 Sep 2019 11:10:22 +0000 (13:10 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 14 Sep 2019 11:11:29 +0000 (13:11 +0200)
Reported by Paul Smith <psmith@gnu.org>.

* lib/findprog-in.c (find_in_given_path): On native Windows, don't try
non-empty suffixes when the file name already contains a '.'.

ChangeLog
lib/findprog-in.c

index 2ef2c89215a7ad7d1dd60fbd663f617e410af06e..d62a962847e9076ede5683697e0688684e1e7a2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2019-09-14  Bruno Haible  <bruno@clisp.org>
+
+       findprog-in: Better mimic the system on native Windows.
+       Reported by Paul Smith <psmith@gnu.org>.
+       * 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  <bruno@clisp.org>
 
        wctob: Fix autoconf test.
index 99b3c314d9dd98bd12a2f79d645f7c98e6075f33..d601e060d911f4f400e8f42cc31e8459f3ed94e3 100644 (file)
@@ -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.  */