Skip to content

Commit

Permalink
Merge pull request open-mpi#305 from gvallee/prun_compile_warnings_fix
Browse files Browse the repository at this point in the history
Fix compilation warnings for prun
  • Loading branch information
rhc54 authored Jan 22, 2020
2 parents 164ab7f + aaab8c4 commit b16845c
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/tools/prun/prun.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
* Copyright (c) 2015-2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2020 Geoffroy Vallee. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -926,7 +927,9 @@ int prun(int argc, char *argv[])
* reach a "safe" place where the termination event can
* be created
*/
pipe(term_pipe);
if (0 != (rc = pipe(term_pipe))) {
exit(1);
}
/* setup an event to attempt normal termination on signal */
myevbase = prrte_progress_thread_init(NULL);
prrte_event_set(myevbase, &term_handler, term_pipe[0], PRRTE_EV_READ, clean_abort, NULL);
Expand Down Expand Up @@ -1062,7 +1065,9 @@ int prun(int argc, char *argv[])
* the user will have seen */
if (!prrte_path_is_absolute(param)) {
char cwd[PRRTE_PATH_MAX];
getcwd(cwd, sizeof(cwd));
if (NULL == getcwd(cwd, sizeof(cwd))) {
return PRRTE_ERR_FATAL;
}
ptr = prrte_os_path(false, cwd, param, NULL);
} else {
ptr = strdup(param);
Expand All @@ -1080,7 +1085,9 @@ int prun(int argc, char *argv[])
* the user will have seen */
if (!prrte_path_is_absolute(ptr)) {
char cwd[PRRTE_PATH_MAX];
getcwd(cwd, sizeof(cwd));
if (NULL == getcwd(cwd, sizeof(cwd))) {
return PRRTE_ERR_FATAL;
}
param = prrte_os_path(false, cwd, ptr, NULL);
} else {
param = strdup(ptr);
Expand Down Expand Up @@ -2021,10 +2028,14 @@ static void abort_signal_callback(int fd)
if ((current.tv_sec - last.tv_sec) < 5) {
exit(1);
}
write(1, (void*)msg, strlen(msg));
if (-1 == write(1, (void*)msg, strlen(msg))) {
exit(1);
}
}
/* save the time */
last.tv_sec = current.tv_sec;
/* tell the event lib to attempt to abnormally terminate */
write(term_pipe[1], &foo, 1);
if (-1 == write(term_pipe[1], &foo, 1)) {
exit(1);
}
}

0 comments on commit b16845c

Please sign in to comment.