mc_tmpdir: Check return value of getpwuid() for NULL.

This commit is contained in:
Andrew V. Samoilov 2004-08-17 18:45:47 +00:00
parent cdc35124d3
commit 72488a9d6c
1 changed files with 7 additions and 1 deletions

View File

@ -323,8 +323,14 @@ mc_tmpdir (void)
}
pwd = getpwuid (getuid ());
g_snprintf (buffer, sizeof (buffer), "%s/mc-%s", sys_tmp,
if (pwd)
g_snprintf (buffer, sizeof (buffer), "%s/mc-%s", sys_tmp,
pwd->pw_name);
else
g_snprintf (buffer, sizeof (buffer), "%s/mc-%d", sys_tmp,
getuid ());
canonicalize_pathname (buffer);
if (lstat (buffer, &st) == 0) {