From: Kevin McCarthy Date: Thu, 17 Nov 2016 23:07:14 +0000 (-0800) Subject: Backout inlining of MUTT_VERSION in 42fee7585fae. X-Git-Tag: neomutt-20170113~15^2~16 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d1807959835eb6c195afbf37ae72ff2f3e3c2c3;p=neomutt Backout inlining of MUTT_VERSION in 42fee7585fae. If MUTT_VERSION contains a %, this will result in problems. --- diff --git a/init.c b/init.c index ee271538c..31de34249 100644 --- 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); }