Honor "TMPDIR" environment variable
Replace all hardcoded paths referring to "/tmp" with a new function that honors the "TMPDIR" environment variable as well as P_tmpdir and uses "/tmp" as a fallback. Thanks-to: Erik Saule <esaule@bmi.osu.edu> Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
15
src/utils.c
15
src/utils.c
@@ -726,6 +726,21 @@ print_bool_option_incolor (WINDOW *win, unsigned option, int pos_y, int pos_x)
|
||||
wins_doupdate ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the name of the default directory for temporary files.
|
||||
*/
|
||||
const char *
|
||||
get_tempdir (void)
|
||||
{
|
||||
if (getenv ("TMPDIR"))
|
||||
return getenv ("TMPDIR");
|
||||
else if (P_tmpdir)
|
||||
return P_tmpdir;
|
||||
else
|
||||
return "/tmp";
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new unique file, and return a newly allocated string which contains
|
||||
* the random part of the file name.
|
||||
|
||||
Reference in New Issue
Block a user