src/windows/back/linker_md.c

Print this page
rev 6641 : [mq]: PrivateTransportTest

*** 42,71 **** const char* pname, const char* fname) { // Based on os_windows.cpp char *path_sep = PATH_SEPARATOR; char *pathname = (char *)pname; while (strlen(pathname) > 0) { char *p = strchr(pathname, *path_sep); if (p == NULL) { p = pathname + strlen(pathname); } /* check for NULL path */ if (p == pathname) { continue; } if (*(p-1) == ':' || *(p-1) == '\\') { ! (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname), pathname, fname); } else { ! (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname), pathname, fname); } if (_access(buffer, 0) == 0) { break; } pathname = p + 1; *buffer = '\0'; } } /* --- 42,76 ---- const char* pname, const char* fname) { // Based on os_windows.cpp char *path_sep = PATH_SEPARATOR; char *pathname = (char *)pname; + *buffer = '\0'; while (strlen(pathname) > 0) { char *p = strchr(pathname, *path_sep); if (p == NULL) { p = pathname + strlen(pathname); } /* check for NULL path */ if (p == pathname) { continue; } if (*(p-1) == ':' || *(p-1) == '\\') { ! (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname), pathname, fname); } else { ! (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname), pathname, fname); } if (_access(buffer, 0) == 0) { break; } + if (*p == '\0') { + pathname = p; + } else { pathname = p + 1; + } *buffer = '\0'; } } /*