From: Pietro Cerutti Date: Tue, 24 Jan 2017 16:42:43 +0000 (+0000) Subject: Revert "Avoid cyclic checks on pipes" X-Git-Tag: neomutt-20170128~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fad21d73fadfa1cbfd600e1a77957ed75aa2eae6;p=neomutt Revert "Avoid cyclic checks on pipes" This reverts commit 0cdb4ad8e5c41c2e6fd3b5a5608f965a2046cc0b. --- diff --git a/init.c b/init.c index fd5cc6d70..9e2480630 100644 --- a/init.c +++ b/init.c @@ -2671,35 +2671,28 @@ static int source_rc (const char *rcfile_path, BUFFER *err) strncpy(rcfile, rcfile_path, PATH_MAX); + if (!to_absolute_path(rcfile, mutt_front_heap(MuttrcHeap))) + { + mutt_error("Error: impossible to build path of '%s'.", rcfile_path); + return (-1); + } + dprint(2, (debugfile, "Reading configuration file '%s'.\n", rcfile)); - if ((f = mutt_open_read (rcfile, &pid)) == NULL) + if (!MuttrcHeap || mutt_find_heap(MuttrcHeap, rcfile) == NULL) { - snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno)); + mutt_push_heap(&MuttrcHeap, rcfile); + } + else + { + mutt_error("Error: Cyclic sourcing of configuration file '%s'.", rcfile); return (-1); } - /* Avoid cyclic sourcing checks on pipes */ - if (pid == -1) + if ((f = mutt_open_read (rcfile, &pid)) == NULL) { - if (!to_absolute_path(rcfile, mutt_front_heap(MuttrcHeap))) - { - mutt_error("Error: impossible to build path of '%s'.", rcfile_path); - safe_fclose (&f); - return (-1); - } - - - if (!MuttrcHeap || mutt_find_heap(MuttrcHeap, rcfile) == NULL) - { - mutt_push_heap(&MuttrcHeap, rcfile); - } - else - { - mutt_error("Error: Cyclic sourcing of configuration file '%s'.", rcfile); - safe_fclose (&f); - return (-1); - } + snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno)); + return (-1); } mutt_buffer_init (&token);