to init.c (the one that was supposed to prevent Mutt from silently
failing to read nonexistant RC files, IIRC) changed source_rc() to
stat(2) the RC "file" before trying to mutt_open_read() it. There's
only one problem here: source_rc() has no way of knowing whether or
not its "file" is a file or a command. I'm attaching a patch that
fixes the problem in what I believe is the right way.
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)
{
FILE *mutt_open_read (const char *path, pid_t *thepid)
{
FILE *f;
+ struct stat s;
+
int len = mutt_strlen (path);
if (path[len - 1] == '|')
}
else
{
+ if (stat (path, &s) < 0)
+ {
+ mutt_error (_("%s: stat: %s"), path, strerror (errno));
+ return (NULL);
+ }
+ if (!S_ISREG (s.st_mode))
+ {
+ mutt_error (_("%s: not a regular file"), path);
+ return (NULL);
+ }
f = fopen (path, "r");
*thepid = -1;
}