From d2d114d819504bccd62e77fe433384d9101a62a8 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 13 Feb 2006 10:42:04 +0000 Subject: When searching for a list of checkpoint files in recovery mode IO::recover = "{auto|autoprobe}": check for a '.file_' suffix for chunked output files (and not only for '.file_0' as processor 0's output). This allows for recovery from a chunked checkpoint in auto mode even if not all the chunked checkpoint files are visible to all processors (eg. if the checkpoint directory is local on a compute node on a cluster). git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/IOUtil/trunk@236 b32723a9-ab3a-4a60-88e2-2e5d99d7c17a --- src/CheckpointRecovery.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/CheckpointRecovery.c b/src/CheckpointRecovery.c index a92f13d..786c9fc 100644 --- a/src/CheckpointRecovery.c +++ b/src/CheckpointRecovery.c @@ -570,7 +570,7 @@ int IOUtil_RecoverParameters (int (*recover_fn) (cGH *GH, #ifdef HAVE_DIRENT_H int len, extension_len, recover_file_len; unsigned int num_files; - const char *p; + const char *p, *q; DIR *dir; struct dirent *file; filelist_t *filelist, *tmp; @@ -624,17 +624,21 @@ int IOUtil_RecoverParameters (int (*recover_fn) (cGH *GH, continue; } - /* check for a '.file_' suffix for chunked output - We only select the chunked output file of processor 0 in that case. */ - if (! strncmp (p, ".file_", 6) && strncmp (p, ".file_0", 7)) + /* check for a '.file_' suffix for chunked output */ + if (! strncmp (p, ".file_", 6)) { continue; } - /* finally check the file type suffix */ - len = strlen (file->d_name); - if (len < extension_len || - strcmp (file->d_name + len - extension_len, fileExtension)) + /* read past the number and check the file extension suffix */ + for (q = p + 6; *q && *q != '.'; q++) + { + if (! isdigit ((int) *q)) + { + break; + } + } + if (*q != '.' || strcmp (q + 1, fileExtension)) { continue; } -- cgit v1.2.3