Re: PATCH: Bugfix on -F
Thanks, this is in the CVS now.
On 2004-01-18 18:35:04 -0500, Mike Schiraldi wrote:
> From: Mike Schiraldi <1074468571@xxxxxxxxxxxxx>
> To: mutt-dev@xxxxxxxx
> Date: Sun, 18 Jan 2004 18:35:04 -0500
> Subject: PATCH: Bugfix on -F
> X-Spam-Level:
>
> 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.
> Index: init.c
> ===================================================================
> RCS file: /home/roessler/cvs/mutt/init.c,v
> retrieving revision 3.17
> diff -u -r3.17 init.c
> --- init.c 4 Jan 2004 11:10:21 -0000 3.17
> +++ init.c 18 Jan 2004 23:26:03 -0000
> @@ -1254,6 +1254,18 @@
> 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)
> {
--
Thomas Roessler · Personal soap box at <http://log.does-not-exist.org/>.