From 34f094312fc2e9dce7621449e07f25c748039f97 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sat, 9 Jul 2011 17:48:28 +0200 Subject: 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 Signed-off-by: Lukas Fleischer --- src/io.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/io.c') diff --git a/src/io.c b/src/io.c index f82de50..74a8089 100644 --- a/src/io.c +++ b/src/io.c @@ -220,7 +220,8 @@ get_export_stream (enum export_type type) (void)snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", home, file_ext[type]); else - (void)snprintf (stream_name, BUFSIZ, "/tmp/calcurse.%s", file_ext[type]); + (void)snprintf (stream_name, BUFSIZ, "%s/calcurse.%s", get_tempdir (), + file_ext[type]); while (stream == NULL) { @@ -2857,10 +2858,11 @@ io_import_data (enum import_type type, struct conf *conf, char *stream_name) struct io_file * io_log_init (void) { - const char *logprefix = "/tmp/calcurse_log."; + char logprefix[BUFSIZ]; char *logname; struct io_file *log; + snprintf (logprefix, BUFSIZ, "%s/calcurse_log.", get_tempdir ()); logname = new_tempfile (logprefix, NOTESIZ); RETVAL_IF (logname == NULL, 0, _("Warning: could not create temporary log file, Aborting...")); -- cgit v1.2.3-54-g00ecf