From 8943afc878fa6d26006aaa409d31df183a150660 Mon Sep 17 00:00:00 2001 From: Phil Carns Date: Fri, 16 Aug 2024 14:59:33 -0400 Subject: [PATCH] write trailing null byte in mnt table - this should make the log format slightly more robust with respect to how the data is decompressed, but does not require any file format change --- darshan-runtime/lib/darshan-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/darshan-runtime/lib/darshan-core.c b/darshan-runtime/lib/darshan-core.c index d3b15d3e8..3a05a51d3 100644 --- a/darshan-runtime/lib/darshan-core.c +++ b/darshan-runtime/lib/darshan-core.c @@ -1701,8 +1701,12 @@ static int darshan_log_open(char *logfile_name, struct darshan_core_runtime *cor static int darshan_log_write_job_record(darshan_core_log_fh log_fh, struct darshan_core_runtime *core, uint64_t *inout_off) { + /* prepare to write two contiguous elements in file: the job structure + * and a trailing string that contains the command line and mount table + * information. Include a trailing null byte in the latter. + */ void *pointers[2] = {core->log_job_p, core->log_exemnt_p}; - int lengths[2] = {sizeof(struct darshan_job), strlen(core->log_exemnt_p)}; + int lengths[2] = {sizeof(struct darshan_job), strlen(core->log_exemnt_p)+1}; int comp_buf_sz = core->config.mod_mem; int ret;