]> granicus.if.org Git - neomutt/commitdiff
Do not pop from MuttrcStack what wasn't pushed
authorPietro Cerutti <gahr@gahr.ch>
Wed, 13 Sep 2017 13:05:34 +0000 (13:05 +0000)
committerRichard Russon <rich@flatcap.org>
Wed, 13 Sep 2017 21:57:58 +0000 (22:57 +0100)
Issue #751

init.c

diff --git a/init.c b/init.c
index 4618b812d1043e2ebb005ba5507425352cd863e1..d8a8168e291f542fc566deba85f0a9ee575ae197 100644 (file)
--- a/init.c
+++ b/init.c
@@ -3166,6 +3166,7 @@ static int source_rc(const char *rcfile_path, struct Buffer *err)
   char rcfile[PATH_MAX];
   size_t buflen;
   size_t rcfilelen;
+  bool ispipe;
 
   pid_t pid;
 
@@ -3175,7 +3176,9 @@ static int source_rc(const char *rcfile_path, struct Buffer *err)
   if (rcfilelen == 0)
     return -1;
 
-  if (rcfile[rcfilelen - 1] != '|')
+  ispipe = rcfile[rcfilelen -1] == '|';
+
+  if (!ispipe)
   {
     struct ListNode *np = STAILQ_FIRST(&MuttrcStack);
     if (!to_absolute_path(rcfile, np ? NONULL(np->data) : ""))
@@ -3278,7 +3281,7 @@ static int source_rc(const char *rcfile_path, struct Buffer *err)
     }
   }
 
-  if (!STAILQ_EMPTY(&MuttrcStack))
+  if (!ispipe && !STAILQ_EMPTY(&MuttrcStack))
   {
     STAILQ_REMOVE_HEAD(&MuttrcStack, entries);
   }