Bug 325471 - Broken search path to binary on linux in xulrunner-stub and firefox-bin - patch by Pawel Chmielowski (prefiks@aviary.pl) - r+a=me
git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@192802 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1075,6 +1075,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;
|
||||
|
||||
@@ -1117,8 +1118,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)
|
||||
|
||||
Reference in New Issue
Block a user