Skip to content

Commit 56f0c82

Browse files
committed
Use ".dup.darshan" suffix for duplicated log file name
1 parent 6a5c60f commit 56f0c82

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

darshan-runtime/lib/darshan-core.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ void darshan_core_shutdown(int write_log)
489489
*/
490490
int mmap_fd = open(final_core->mmap_log_name, O_RDONLY, 0644);
491491
if (mmap_fd != -1) {
492+
char *dup_suffix = ".dup.darshan";
492493
int err, dup_mmap_fd;
493494
void *buf = (void*) malloc(final_core->mmap_size);
494495
ssize_t rlen = read(mmap_fd, buf, final_core->mmap_size);
@@ -497,8 +498,8 @@ void darshan_core_shutdown(int write_log)
497498
err = close(mmap_fd);
498499
if (err < 0)
499500
darshan_core_fprintf(stderr, "darshan:log duplication close (%s)\n", strerror(errno));
500-
snprintf(dup_log_fame, strlen(final_core->mmap_log_name)+5, "%s.dup",
501-
final_core->mmap_log_name);
501+
strncpy(dup_log_fame, final_core->mmap_log_name, __DARSHAN_PATH_MAX);
502+
snprintf(strstr(dup_log_fame, ".darshan"), strlen(dup_suffix), "%s", dup_suffix);
502503
dup_mmap_fd = open(dup_log_fame, O_CREAT | O_WRONLY, 0644);
503504
if (dup_mmap_fd != -1) {
504505
ssize_t wlen = write(dup_mmap_fd, buf, final_core->mmap_size);

0 commit comments

Comments
 (0)