mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-16 13:56:29 +00:00
Bug 325471 Broken search for path to binary on linux in xulrunner-stub
patch by prefiks@aviary.pl r=bsmedberg
This commit is contained in:
parent
7c51177559
commit
0fb88d98ce
@ -1078,6 +1078,7 @@ XRE_GetBinaryPath(const char* argv0, nsILocalFile* *aResult)
|
||||
#elif defined(XP_UNIX)
|
||||
struct stat fileStat;
|
||||
char exePath[MAXPATHLEN];
|
||||
char tmpPath[MAXPATHLEN];
|
||||
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
@ -1120,8 +1121,8 @@ XRE_GetBinaryPath(const char* argv0, nsILocalFile* *aResult)
|
||||
char *newStr = pathdup;
|
||||
char *token;
|
||||
while ( (token = nsCRT::strtok(newStr, ":", &newStr)) ) {
|
||||
sprintf(exePath, "%s/%s", token, argv0);
|
||||
if (stat(exePath, &fileStat) == 0) {
|
||||
sprintf(tmpPath, "%s/%s", token, argv0);
|
||||
if (realpath(tmpPath, exePath) && stat(exePath, &fileStat) == 0) {
|
||||
found = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ main(int argc, char **argv)
|
||||
char *lastSlash;
|
||||
|
||||
char iniPath[MAXPATHLEN];
|
||||
char tmpPath[MAXPATHLEN];
|
||||
|
||||
#ifdef XP_WIN
|
||||
if (!::GetModuleFileName(NULL, iniPath, sizeof(iniPath)))
|
||||
@ -96,11 +97,12 @@ main(int argc, char **argv)
|
||||
PRBool found = PR_FALSE;
|
||||
char *token = strtok(pathdup, ":");
|
||||
while (token) {
|
||||
sprintf(iniPath, "%s/%s", token, argv[0]);
|
||||
if (stat(iniPath, &fileStat) == 0) {
|
||||
sprintf(tmpPath, "%s/%s", token, argv[0]);
|
||||
if (realpath(tmpPath, iniPath) && stat(iniPath, &fileStat) == 0) {
|
||||
found = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
token = strtok(NULL, ":");
|
||||
}
|
||||
free (pathdup);
|
||||
if (!found)
|
||||
|
Loading…
x
Reference in New Issue
Block a user