summaryrefslogtreecommitdiff
path: root/usr.bin/from
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2015-06-03 02:35:51 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2015-06-03 02:35:51 +0000
commit5a23abd93e27f4b7758637e9c2ad8b7bcc4369d1 (patch)
treea2f8fa86c48b21c965ef38d166a931abcbb497fb /usr.bin/from
parent53f83ea972c751a287eed99558f9349e7238bc9f (diff)
Move warning on open failure to open_mbox() where we have the file name.
Diffstat (limited to 'usr.bin/from')
-rw-r--r--usr.bin/from/from.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/from/from.c b/usr.bin/from/from.c
index da2230fd8cf..96b2fc065ff 100644
--- a/usr.bin/from/from.c
+++ b/usr.bin/from/from.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: from.c,v 1.18 2015/06/02 15:44:17 millert Exp $ */
+/* $OpenBSD: from.c,v 1.19 2015/06/03 02:35:50 millert Exp $ */
/* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */
/*
@@ -73,7 +73,7 @@ main(int argc, char *argv[])
argv += optind;
if ((fp = open_mbox(file, *argv)) == NULL)
- err(1, "%s", file);
+ exit(1);
for (newline = 1; (linelen = getline(&line, &linesize, fp)) != -1;) {
if (*line == '\n') {
newline = 1;
@@ -120,7 +120,8 @@ open_mbox(const char *file, const char *user)
file = buf;
}
}
- fp = fopen(file, "r");
+ if ((fp = fopen(file, "r")) == NULL)
+ warn("%s", file);
free(buf);
return(fp);
}