Skip to content

Commit af3a6e1

Browse files
author
Mark Santcroos
committed
Verify that the chdir(2) succeeds.
Signed-off-by: Mark Santcroos <[email protected]>
1 parent 36ac54b commit af3a6e1

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

orte/mca/odls/alps/odls_alps_module.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* Copyright (c) 2011-2014 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
19+
* Copyright (c) 2017 Rutgers, The State University of New Jersey.
20+
* All rights reserved.
1921
*
2022
* $COPYRIGHT$
2123
*
@@ -425,7 +427,16 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd)
425427

426428
/* take us to the correct wdir */
427429
if (NULL != cd->wdir) {
428-
chdir(cd->wdir);
430+
if (0 != chdir(cd->wdir)) {
431+
send_error_show_help(write_fd, 1,
432+
"help-orterun.txt",
433+
"orterun:wdir-not-found",
434+
orte_basename,
435+
cd->wdir,
436+
orte_process_info.nodename,
437+
cd->child->app_rank);
438+
/* Does not return */
439+
}
429440
}
430441

431442
/* Exec the new executable */

orte/mca/odls/default/odls_default_module.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* Copyright (c) 2011-2013 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* Copyright (c) 2013-2017 Intel, Inc. All rights reserved.
19+
* Copyright (c) 2017 Rutgers, The State University of New Jersey.
20+
* All rights reserved.
1921
*
2022
* $COPYRIGHT$
2123
*
@@ -416,7 +418,16 @@ static int do_child(orte_odls_spawn_caddy_t *cd, int write_fd)
416418

417419
/* take us to the correct wdir */
418420
if (NULL != cd->wdir) {
419-
chdir(cd->wdir);
421+
if (0 != chdir(cd->wdir)) {
422+
send_error_show_help(write_fd, 1,
423+
"help-orterun.txt",
424+
"orterun:wdir-not-found",
425+
orte_basename,
426+
cd->wdir,
427+
orte_process_info.nodename,
428+
cd->child->app_rank);
429+
/* Does not return */
430+
}
420431
}
421432

422433
/* Exec the new executable */

0 commit comments

Comments
 (0)