diff options
Diffstat (limited to 'src/CheckpointRecovery.c')
-rw-r--r-- | src/CheckpointRecovery.c | 20 |
1 files 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_<processor>' 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_<processor>' 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 <processor> 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; } |