mirror of https://github.com/BOINC/boinc.git
lib: change run_program() to use $PATH
GPU detection tries to launch a copy of the client using full path to the client executable but getting the full path may fail. In this case the code falls back to using argv[0] but argv[0] doesn't always contain path to the client. This may happen if the client was started from shell and the shell used $PATH to find the client executable. Change run_program() to search $PATH for the program file if the file name doesn't include path.
This commit is contained in:
parent
c4708d24de
commit
6db39da602
10
lib/util.cpp
10
lib/util.cpp
|
@ -414,7 +414,7 @@ int read_file_string(
|
|||
|
||||
#ifdef _WIN32
|
||||
int run_program(
|
||||
const char* dir, const char* file, int argc, char *const argv[], double nsecs, HANDLE& id
|
||||
const char* dir, const char* /*file*/, int argc, char *const argv[], double nsecs, HANDLE& id
|
||||
) {
|
||||
int retval;
|
||||
PROCESS_INFORMATION process_info;
|
||||
|
@ -436,7 +436,7 @@ int run_program(
|
|||
}
|
||||
|
||||
retval = CreateProcessA(
|
||||
file,
|
||||
NULL,
|
||||
cmdline,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -479,11 +479,11 @@ int run_program(
|
|||
retval = chdir(dir);
|
||||
if (retval) return retval;
|
||||
}
|
||||
execv(file, argv);
|
||||
execvp(file, argv);
|
||||
#ifdef _USING_FCGI_
|
||||
FCGI::perror("execv");
|
||||
FCGI::perror("execvp");
|
||||
#else
|
||||
perror("execv");
|
||||
perror("execvp");
|
||||
#endif
|
||||
exit(errno);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue