]> granicus.if.org Git - neomutt/commitdiff
refactor: tmpdir config
authorRichard Russon <rich@flatcap.org>
Fri, 30 Mar 2018 14:15:50 +0000 (15:15 +0100)
committerRichard Russon <rich@flatcap.org>
Tue, 3 Apr 2018 02:38:52 +0000 (03:38 +0100)
Precedence: environment, config, code

init.c
init.h

diff --git a/init.c b/init.c
index e5d6b2246bc218a24fedd0368a96a0609c0be35f..5c10dbf1ed471d91cd48dec3c3d809373fd5bfab 100644 (file)
--- 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 2ae357d503fe7e4e344b8d9ddec0dbff683841ee..76bd4cfedbd5920353165131c8f3622121967ef4 100644 (file)
--- 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