From: Ramiro Polla Date: Wed, 22 Sep 2010 02:06:06 +0000 (-0300) Subject: Fix finding of executables with dots in the filename on win32 X-Git-Tag: v3.2~317 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e0fd56aaa0e588c01ad0ea1b070576283d3fdfb;p=thirdparty%2Fccache.git Fix finding of executables with dots in the filename on win32 --- diff --git a/execute.c b/execute.c index 6cd0f5682..48addf677 100644 --- 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);