From: Mike Schiraldi <1074468571@schiraldi.org> Date: Sun, 1 Feb 2004 18:00:16 +0000 (+0000) Subject: As you all know, running "mutt -F foo.rc" will have mutt read foo.rc X-Git-Tag: mutt-1-5-6-rel~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f36d3d3da3b1d676376f31a152bc968cbc86781;p=mutt As you all know, running "mutt -F foo.rc" will have mutt read foo.rc as its config file. However, there is a bug -- if you specify a directory (like accidentally typing "mutt -F /etc/mutt") mutt will silently ignore the flag and leave you wondering why it isn't working. Emil Sit posted a patch for this in March of 2002, but it seems to have slipped through the cracks. Here's the patch again; please consider it for inclusion. --- diff --git a/init.c b/init.c index db636b4a..80ef6ee7 100644 --- a/init.c +++ b/init.c @@ -1368,6 +1368,18 @@ static int source_rc (const char *rcfile, BUFFER *err) char *linebuf = NULL; size_t buflen; pid_t pid; + struct stat s; + + if (stat (rcfile, &s) < 0) + { + snprintf (err->data, err->dsize, _("%s: stat: %s"), rcfile, strerror (errno)); + return (-1); + } + if (!S_ISREG (s.st_mode)) + { + snprintf (err->data, err->dsize, _("%s: not a regular file"), rcfile); + return (-1); + } if ((f = mutt_open_read (rcfile, &pid)) == NULL) {