зеркало из https://github.com/mozilla/gecko-dev.git
Bug 670788 - When looking for the executable path on Unix, only use realpath() when we got a file path in the first place. r=bsmedberg
This commit is contained in:
Родитель
0ec7b9b37e
Коммит
ab86342353
|
@ -46,6 +46,7 @@
|
|||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#elif defined(XP_UNIX)
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -102,10 +103,11 @@ private:
|
|||
// multiple applications, we will try a series of techniques:
|
||||
//
|
||||
// 1) use realpath() on argv[0], which works unless we're loaded from the
|
||||
// PATH
|
||||
// PATH. Only do so if argv[0] looks like a path (contains a /).
|
||||
// 2) manually walk through the PATH and look for ourself
|
||||
// 3) give up
|
||||
if (realpath(argv0, aResult) && stat(aResult, &fileStat) == 0)
|
||||
if (strchr(argv0, '/') && realpath(argv0, aResult) &&
|
||||
stat(aResult, &fileStat) == 0)
|
||||
return NS_OK;
|
||||
|
||||
const char *path = getenv("PATH");
|
||||
|
|
Загрузка…
Ссылка в новой задаче