]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix finding of executables with dots in the filename on win32
authorRamiro Polla <ramiro.polla@gmail.com>
Wed, 22 Sep 2010 02:06:06 +0000 (23:06 -0300)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 26 Sep 2010 20:12:03 +0000 (22:12 +0200)
execute.c

index 6cd0f5682c95b4d5969be3c4a57284fadf62363e..48addf67789f83163064c8e61a09bffc0769dacf 100644 (file)
--- a/execute.c
+++ b/execute.c
@@ -256,11 +256,14 @@ find_executable_in_path(const char *name, const char *exclude_name, char *path)
             tok = strtok_r(NULL, PATH_DELIM, &saveptr)) {
 #ifdef _WIN32
                char namebuf[MAX_PATH];
-               int ret = SearchPath(tok, name, ".exe",
+               int ret = SearchPath(tok, name, NULL,
                                     sizeof(namebuf), namebuf, NULL);
-               if (!ret)
-                       ret = SearchPath(tok, name, NULL,
+               if (!ret) {
+                       char *exename = format("%s.exe", name);
+                       ret = SearchPath(tok, exename, NULL,
                                         sizeof(namebuf), namebuf, NULL);
+                       free(exename);
+               }
                (void) exclude_name;
                if (ret) {
                        free(path);