From: Thomas Roessler Date: Sun, 8 Feb 2004 09:38:38 +0000 (+0000) Subject: Change the logic in mutt_open_read to only catch directories -- mutt X-Git-Tag: mutt-1-5-15-rel~217 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=66d8935bb921a6ca5b4f2c5e0bdf5dcdf8d9c28d;p=mutt Change the logic in mutt_open_read to only catch directories -- mutt may legitimately read devices (think /dev/null) or named pipes. Also delegate error reporting to the calling function by setting errno. --- diff --git a/muttlib.c b/muttlib.c index 8370a3e8..5f155147 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1152,13 +1152,10 @@ FILE *mutt_open_read (const char *path, pid_t *thepid) else { if (stat (path, &s) < 0) - { - mutt_error (_("%s: stat: %s"), path, strerror (errno)); return (NULL); - } - if (!S_ISREG (s.st_mode)) + if (S_ISDIR (s.st_mode)) { - mutt_error (_("%s: not a regular file"), path); + errno = EINVAL; return (NULL); } f = fopen (path, "r");