From 8d79bfe8601b7478e987319460f30d764dd97904 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 29 Mar 2008 13:15:22 +0000 Subject: [PATCH] Fix for CID 937. All we really care about is being able to chrdir; the extra checks were unnecessary. This commit was SVN r18015. --- orte/util/context_fns.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/orte/util/context_fns.c b/orte/util/context_fns.c index 84ed8a50c3..1e6583151f 100644 --- a/orte/util/context_fns.c +++ b/orte/util/context_fns.c @@ -10,6 +10,7 @@ * Copyright (c) 2004-2005 The Regents of the University of California. * All rights reserved. * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * 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 */ gethostname(hostname, sizeof(hostname)); - /* If the directory does not exist, or stat() otherwise fails to - get info about it, then set good = false. */ - if (!(0 == stat(context->cwd, &buf) && S_ISDIR(buf.st_mode))) { - good = false; - } - - /* 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)) { + /* If we want to chdir and the chdir fails (for any reason -- such + as if the dir doesn't exist, it isn't a dir, we don't have + permissions, etc.), then set good to false. */ + if (want_chdir && 0 != chdir(context->cwd)) { good = false; } @@ -88,12 +84,9 @@ int orte_util_check_context_cwd(orte_app_context_t *context, instead. */ tmp = getenv("HOME"); if (NULL != tmp) { - /* Try $HOME. Same 2 tests as above. */ + /* Try $HOME. Same test as above. */ good = true; - if (!(0 == stat(tmp, &buf) && S_ISDIR(buf.st_mode))) { - good = false; - } - if (good && want_chdir && 0 != chdir(tmp)) { + if (want_chdir && 0 != chdir(tmp)) { good = false; } if (!good) {