Fix Landlock Make crash when TMPDIR isn't defined

This commit is contained in:
Justine Tunney 2023-09-06 12:49:52 -07:00
parent f531acc8f9
commit f9c9a323fe
No known key found for this signature in database
GPG key ID: BE714B4575D6E328

View file

@ -413,7 +413,10 @@ get_target_variable (const char *name,
char *
get_tmpdir (struct file *file)
{
return strdup (get_target_variable (STRING_SIZE_TUPLE ("TMPDIR"), file, 0));
const char *tmpdir;
tmpdir = get_target_variable (STRING_SIZE_TUPLE ("TMPDIR"), file, 0);
if (!tmpdir) tmpdir = kTmpPath;
return strdup (tmpdir);
}
char *