Skip to content

Commit 31fc6e0

Browse files
committed
opal_wrapper: consolidate extra variable name
We don't need to have two variables: one named exec_command and one named exec_cmd. Consolidate down to just a single variable (exec_command), and in doing so, fix a compiler warning that exec_command may not have been initialized (due to confusion between exec_command and exec_cmd). Also remove some #if 0/dead code. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent 2ef2300 commit 31fc6e0

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

opal/tools/wrappers/opal_wrapper.c

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* University of Stuttgart. All rights reserved.
1010
* Copyright (c) 2004-2005 The Regents of the University of California.
1111
* All rights reserved.
12-
* Copyright (c) 2007-2015 Cisco Systems, Inc. All rights reserved.
12+
* Copyright (c) 2007-2021 Cisco Systems, Inc. All rights reserved
1313
* Copyright (c) 2007-2013 Los Alamos National Security, LLC. All rights
1414
* reserved.
1515
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
@@ -940,14 +940,9 @@ int main(int argc, char *argv[])
940940
if (flags & COMP_DRY_RUN) {
941941
exec_command = opal_argv_join(exec_argv, ' ');
942942
printf("%s\n", exec_command);
943+
free(exec_command);
943944
} else {
944945
char *tmp;
945-
946-
#if 0
947-
exec_command = opal_argv_join(exec_argv, ' ');
948-
printf("command: %s\n", exec_command);
949-
#endif
950-
951946
tmp = opal_path_findv(exec_argv[0], 0, environ, NULL);
952947
if (NULL == tmp) {
953948
opal_show_help("help-opal-wrapper.txt", "no-compiler-found", true, exec_argv[0], NULL);
@@ -964,17 +959,12 @@ int main(int argc, char *argv[])
964959
? WTERMSIG(status)
965960
: (WIFSTOPPED(status) ? WSTOPSIG(status) : 255));
966961
if ((OPAL_SUCCESS != ret) || ((0 != exit_status) && (flags & COMP_SHOW_ERROR))) {
967-
char* exec_cmd = opal_argv_join(exec_argv, ' ');
968962
if (OPAL_SUCCESS != ret) {
963+
exec_command = opal_argv_join(exec_argv, ' ');
969964
opal_show_help("help-opal-wrapper.txt", "spawn-failed", true, exec_argv[0],
970965
strerror(status), exec_command, NULL);
971-
} else {
972-
#if 0
973-
opal_show_help("help-opal-wrapper.txt", "compiler-failed", true,
974-
exec_argv[0], exit_status, exec_cmd, NULL);
975-
#endif
966+
free(exec_command);
976967
}
977-
free(exec_cmd);
978968
}
979969
}
980970
}

0 commit comments

Comments
 (0)