1
1

Fix for CID 937. All we really care about is being able to chrdir;

the extra checks were unnecessary.

This commit was SVN r18015.
Этот коммит содержится в:
Jeff Squyres 2008-03-29 13:15:22 +00:00
родитель d0f12f3df0
Коммит 8d79bfe860

Просмотреть файл

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -61,15 +62,10 @@ int orte_util_check_context_cwd(orte_app_context_t *context,
/* Use hostname in a few messages below */ /* Use hostname in a few messages below */
gethostname(hostname, sizeof(hostname)); gethostname(hostname, sizeof(hostname));
/* If the directory does not exist, or stat() otherwise fails to /* If we want to chdir and the chdir fails (for any reason -- such
get info about it, then set good = false. */ as if the dir doesn't exist, it isn't a dir, we don't have
if (!(0 == stat(context->cwd, &buf) && S_ISDIR(buf.st_mode))) { permissions, etc.), then set good to false. */
good = false; if (want_chdir && 0 != chdir(context->cwd)) {
}
/* If the directory does exist, and we want to chdir, and the
chdir fails, then set good = false. */
if (good && want_chdir && 0 != chdir(context->cwd)) {
good = false; good = false;
} }
@ -88,12 +84,9 @@ int orte_util_check_context_cwd(orte_app_context_t *context,
instead. */ instead. */
tmp = getenv("HOME"); tmp = getenv("HOME");
if (NULL != tmp) { if (NULL != tmp) {
/* Try $HOME. Same 2 tests as above. */ /* Try $HOME. Same test as above. */
good = true; good = true;
if (!(0 == stat(tmp, &buf) && S_ISDIR(buf.st_mode))) { if (want_chdir && 0 != chdir(tmp)) {
good = false;
}
if (good && want_chdir && 0 != chdir(tmp)) {
good = false; good = false;
} }
if (!good) { if (!good) {