]> granicus.if.org Git - neomutt/commitdiff
Backout inlining of MUTT_VERSION in 42fee7585fae.
authorKevin McCarthy <kevin@8t8.us>
Thu, 17 Nov 2016 23:07:14 +0000 (15:07 -0800)
committerRichard Russon <rich@flatcap.org>
Fri, 30 Dec 2016 20:05:36 +0000 (20:05 +0000)
If MUTT_VERSION contains a %, this will result in problems.

init.c

diff --git a/init.c b/init.c
index ee271538c827d186bcf6d0eb4e8325578d0a2e91..31de34249baca026d66695a2c206b695f24ec85c 100644 (file)
--- a/init.c
+++ b/init.c
@@ -3220,11 +3220,11 @@ static int mutt_execute_commands (LIST *p)
 
 static char* mutt_find_cfg (const char *home, const char *xdg_cfg_home)
 {
-  const char* names[] =
+  const char* names[][2] =
   {
-    "muttrc-" MUTT_VERSION,
-    "muttrc",
-    NULL,
+    { "muttrc", "-" MUTT_VERSION },
+    { "muttrc", "" },
+    { NULL, NULL },
   };
 
   const char* locations[][2] =
@@ -3244,12 +3244,12 @@ static char* mutt_find_cfg (const char *home, const char *xdg_cfg_home)
     if (!locations[i][0])
       continue;
 
-    for (j = 0; names[j]; j++)
+    for (j = 0; names[j][0]; j++)
     {
       char buffer[STRING];
 
-      snprintf (buffer, sizeof (buffer),
-                "%s/%s%s", locations[i][0], locations[i][1], names[j]);
+      snprintf (buffer, sizeof (buffer), "%s/%s%s%s",
+                locations[i][0], locations[i][1], names[j][0], names[j][1]);
       if (access (buffer, F_OK) == 0)
         return safe_strdup(buffer);
     }