- FILE *f;
- struct stat s;
-
- int len = str_len (path);
-
- if (path[len - 1] == '|') {
- /* read from a pipe */
-
- char *s = str_dup (path);
-
- s[len - 1] = 0;
- mutt_endwin (NULL);
- *thepid = mutt_create_filter (s, NULL, &f, NULL);
- mem_free (&s);
- }
- else {
- if (stat (path, &s) < 0)
- return (NULL);
- if (S_ISDIR (s.st_mode)) {
- errno = EINVAL;
- return (NULL);
+ int len = str_len (path);
+ FILE *f;
+
+ if (path[len - 1] == '|') {
+ char *s = str_dup (path);
+
+ /* read from a pipe */
+
+ s[len - 1] = 0;
+ mutt_endwin (NULL);
+ *thepid = mutt_create_filter (s, NULL, &f, NULL);
+ p_delete(&s);
+ } else {
+ f = fopen (path, "r");
+ if (!f)
+ return NULL;
+ *thepid = -1;