[mpich2-commits] r6737 - mpich2/trunk/src/pm/hydra/tools/ckpoint
buntinas at mcs.anl.gov
buntinas at mcs.anl.gov
Tue May 25 13:43:53 CDT 2010
Author: buntinas
Date: 2010-05-25 13:43:53 -0500 (Tue, 25 May 2010)
New Revision: 6737
Modified:
mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c
Log:
added checks for valid checkpoint directory
Modified: mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c
===================================================================
--- mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c 2010-05-25 18:43:19 UTC (rev 6736)
+++ mpich2/trunk/src/pm/hydra/tools/ckpoint/ckpoint.c 2010-05-25 18:43:53 UTC (rev 6737)
@@ -4,6 +4,9 @@
* See COPYRIGHT in top-level directory.
*/
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
#include "hydra_utils.h"
#include "ckpoint.h"
@@ -16,6 +19,8 @@
HYD_status HYDT_ckpoint_init(char *user_ckpointlib, char *user_ckpoint_prefix)
{
HYD_status status = HYD_SUCCESS;
+ int ret;
+ struct stat st;
HYDU_FUNC_ENTER();
@@ -33,6 +38,10 @@
if (HYDT_ckpoint_info.ckpoint_prefix == NULL)
goto fn_exit;
+ ret = stat(HYDT_ckpoint_info.ckpoint_prefix, &st);
+ HYDU_ERR_CHKANDJUMP(status, ret, HYD_FAILURE, "Failed to stat checkpoint prefix \"%s\": %s\n", HYDT_ckpoint_info.ckpoint_prefix, strerror(errno));
+ HYDU_ERR_CHKANDJUMP(status, !S_ISDIR(st.st_mode), HYD_FAILURE, "checkpoint prefix \"%s\" is not a directory.\n", HYDT_ckpoint_info.ckpoint_prefix);
+
#if defined HAVE_BLCR
if (!strcmp(HYDT_ckpoint_info.ckpointlib, "blcr")) {
status = HYDT_ckpoint_blcr_init();
More information about the mpich2-commits
mailing list