Merge branch 'master' of ssh://boinc.berkeley.edu/boinc-v2

This commit is contained in:
David Anderson 2014-07-24 23:43:06 -07:00
commit 16e45a1ddc
3 changed files with 17 additions and 6 deletions

View File

@ -224,7 +224,7 @@ static void kill_app_process(int pid, bool) {
if (retval && log_flags.task_debug) {
msg_printf(0, MSG_INFO,
"[task] kill_via_switcher() failed: %s",
boincerror(retval)
(retval==-1) ? strerror(errno) : boincerror(retval)
);
}
#endif
@ -232,7 +232,7 @@ static void kill_app_process(int pid, bool) {
if (retval && log_flags.task_debug) {
msg_printf(0, MSG_INFO,
"[task] kill() failed: %s",
boincerror(retval)
(retval==-1) ? strerror(errno) : boincerror(retval)
);
}
}
@ -269,6 +269,7 @@ int ACTIVE_TASK::kill_running_task(bool will_restart) {
int ACTIVE_TASK::kill_exited_task() {
kill_processes(other_pids, true);
kill_processes(descendants, true);
return 0;
}
// We have sent a quit request to the process; see if it's exited.

View File

@ -95,6 +95,7 @@ int set_to_project_group(const char* path) {
int switcher_exec(const char *util_filename, const char* cmdline) {
char* argv[100];
char util_path[MAXPATHLEN];
int stat;
sprintf(util_path, "%s/%s", SWITCHER_DIR, util_filename);
argv[0] = const_cast<char*>(util_filename);
@ -111,7 +112,12 @@ int switcher_exec(const char *util_filename, const char* cmdline) {
return ERR_EXEC;
}
// Wait for command to complete, like system() does.
waitpid(pid, 0, 0);
waitpid(pid, &stat, 0);
if (WIFEXITED(stat)) {
return WEXITSTATUS(stat);
}
return 0;
}

View File

@ -130,9 +130,13 @@ int main(int /*argc*/, char** argv) {
#endif
}
execv(argv[1], argv+2);
retval = execv(argv[1], argv+2);
if (retval == -1) {
retval = errno;
// If we got here execv failed
fprintf(stderr, "Process creation (%s) failed: errno=%d\n", argv[1], errno);
// If we got here execv failed
fprintf(stderr, "Process creation (%s) failed: %s (errno = %d)\n", argv[1], strerror(retval), retval);
}
return retval;
}