Commit 99c456f8 authored by Kevin Harms's avatar Kevin Harms

Workaround for case where cuserid returns nothing. Uses the users uid instead.

git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@540 3b7491f3-a168-0410-bf4b-c445ed680a29
parent f0b322f6
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment