Some mail clients remove the user's spool file instead of truncating
it.  There's no reason to warn in this case unless the user specified
a file with the -f flag.

 - todd

Index: usr.bin/from/from.c
===================================================================
RCS file: /cvs/src/usr.bin/from/from.c,v
retrieving revision 1.19
diff -u -p -u -r1.19 from.c
--- usr.bin/from/from.c 3 Jun 2015 02:35:50 -0000       1.19
+++ usr.bin/from/from.c 3 Jun 2015 14:09:20 -0000
@@ -39,6 +39,7 @@
 #include <paths.h>
 #include <string.h>
 #include <err.h>
+#include <errno.h>
 
 int    match(char *, char *);
 FILE   *open_mbox(const char *file, const char *user);
@@ -89,9 +90,10 @@ main(int argc, char *argv[])
 }
 
 FILE *
-open_mbox(const char *file, const char *user)
+open_mbox(const char *fflag, const char *user)
 {
        struct passwd *pwd;
+       const char *file = fflag;
        char *buf = NULL;
        FILE *fp;
 
@@ -120,8 +122,10 @@ open_mbox(const char *file, const char *
                        file = buf;
                }
        }
-       if ((fp = fopen(file, "r")) == NULL)
-               warn("%s", file);
+       if ((fp = fopen(file, "r")) == NULL) {
+               if (fflag != NULL || errno != ENOENT)
+                       warn("%s", file);
+       }
        free(buf);
        return(fp);
 }

Reply via email to