diff --git a/darshan-runtime/lib/darshan-mpi-io.c b/darshan-runtime/lib/darshan-mpi-io.c index 743911539a1d3f80c2a798cdd32003c402bf098b..125334b30d1351e48d086f5a5921915c6a4a3ff4 100644 --- a/darshan-runtime/lib/darshan-mpi-io.c +++ b/darshan-runtime/lib/darshan-mpi-io.c @@ -439,6 +439,13 @@ void darshan_shutdown(int timing_flag) /* note: getpwuid() causes link errors for static binaries */ cuserid(cuser); + if (strcmp(cuser, "") == 0) + { + /* if node config is wrong, cuserid can return an empty string + this is backup in case that happens. */ + uid_t uid = geteuid(); + snprintf(cuser, sizeof(cuser), "%u", uid); + } /* generate a random number to help differentiate the log */ (void) gethostname(hname, sizeof(hname));