Skip to content

Commit 9c8671c

Browse files
committed
Run-as-root env vars in orterun.c
I found that I needed to apply the same change as #5597 to orterun.c for the environment variables to work correctly. Signed-off-by: Simon Byrne <[email protected]>
1 parent ae1f7e0 commit 9c8671c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

orte/tools/orterun/orterun.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ int orterun(int argc, char *argv[])
142142
* exit with a giant warning flag
143143
*/
144144
if (0 == geteuid() && !orte_cmd_options.run_as_root) {
145+
char *r1, *r2;
146+
if (NULL != (r1 = getenv("OMPI_ALLOW_RUN_AS_ROOT")) &&
147+
NULL != (r2 = getenv("OMPI_ALLOW_RUN_AS_ROOT_CONFIRM"))) {
148+
if (0 == strcmp(r1, "1") && 0 == strcmp(r2, "1")) {
149+
goto moveon;
150+
}
151+
}
152+
145153
fprintf(stderr, "--------------------------------------------------------------------------\n");
146154
if (NULL != orte_cmd_options.help) {
147155
fprintf(stderr, "%s cannot provide the help message when run as root.\n", orte_basename);
@@ -159,6 +167,7 @@ int orterun(int argc, char *argv[])
159167
exit(1);
160168
}
161169

170+
moveon:
162171
/* setup to listen for commands sent specifically to me, even though I would probably
163172
* be the one sending them! Unfortunately, since I am a participating daemon,
164173
* there are times I need to send a command to "all daemons", and that means *I* have

0 commit comments

Comments
 (0)