]> granicus.if.org Git - neomutt/commitdiff
Change the logic in mutt_open_read to only catch directories -- mutt
authorThomas Roessler <roessler@does-not-exist.org>
Sun, 8 Feb 2004 09:38:38 +0000 (09:38 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Sun, 8 Feb 2004 09:38:38 +0000 (09:38 +0000)
may legitimately read devices (think /dev/null) or named pipes. Also
delegate error reporting to the calling function by setting errno.

muttlib.c

index 8370a3e86513e8b8be6e9a3e68c52860db8130f1..5f155147cbb1695503dd161e613d13ec42b2f1fd 100644 (file)
--- 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");