summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2015-06-03 02:35:50 +0000
committermillert <millert@openbsd.org>2015-06-03 02:35:50 +0000
commit02b387923977e85ef602de1e3847ac87c4dc543b (patch)
treefc89dd55219d05b94a6366fa3810ae1f59924ed5
parentDo not assume that asprintf() clears the pointer on failure, which (diff)
downloadwireguard-openbsd-02b387923977e85ef602de1e3847ac87c4dc543b.tar.xz
wireguard-openbsd-02b387923977e85ef602de1e3847ac87c4dc543b.zip
Move warning on open failure to open_mbox() where we have the file name.
-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);
}