From b1740d1592b5f0691eb84be6233026005de9ac67 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 30 Mar 2018 15:15:50 +0100 Subject: [PATCH] refactor: tmpdir config Precedence: environment, config, code --- init.c | 7 +++++-- init.h | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/init.c b/init.c index e5d6b2246..5c10dbf1e 100644 --- a/init.c +++ b/init.c @@ -3760,8 +3760,6 @@ int mutt_init(int skip_sys_rc, struct ListHead *commands) SpoolFile = mutt_str_strdup(buffer); } - Tmpdir = mutt_str_strdup((p = mutt_str_getenv("TMPDIR")) ? p : "/tmp"); - p = mutt_str_getenv("VISUAL"); if (!p) { @@ -3936,6 +3934,11 @@ int mutt_init(int skip_sys_rc, struct ListHead *commands) if (env_mc) mutt_str_replace(&MailcapPath, env_mc); + /* "$tmpdir" precedence: environment, config file, code */ + const char *env_tmp = mutt_str_getenv("TMPDIR"); + if (env_tmp) + mutt_str_replace(&Tmpdir, env_tmp); + if (need_pause && !OPT_NO_CURSES) { log_queue_flush(log_disp_terminal); diff --git a/init.h b/init.h index 2ae357d50..76bd4cfed 100644 --- a/init.h +++ b/init.h @@ -4155,7 +4155,7 @@ struct Option MuttVars[] = { ** .pp ** A value of zero or less will cause NeoMutt to never time out. */ - { "tmpdir", DT_PATH, R_NONE, &Tmpdir, 0 }, + { "tmpdir", DT_PATH, R_NONE, &Tmpdir, IP "/tmp" }, /* ** .pp ** This variable allows you to specify where NeoMutt will place its -- 2.40.0