summaryrefslogtreecommitdiffstats
path: root/init.c
diff options
context:
space:
mode:
authorMike Schiraldi <1074468571@schiraldi.org>2004-02-01 18:00:16 +0000
committerMike Schiraldi <1074468571@schiraldi.org>2004-02-01 18:00:16 +0000
commit2f36d3d3da3b1d676376f31a152bc968cbc86781 (patch)
tree47e8d65e464f9a15c76151be1a7c3262e864e579 /init.c
parentca2488da8a947a2c35aba2680700f7c3680b194d (diff)
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.
Diffstat (limited to 'init.c')
-rw-r--r--init.c12
1 files changed, 12 insertions, 0 deletions
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)
{