summaryrefslogtreecommitdiff
path: root/usr.sbin/config/mkmakefile.c
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2016-10-16 17:50:01 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2016-10-16 17:50:01 +0000
commit31dcef6aecdf49dc9f5f9931fecbcb6a386f26e0 (patch)
tree0fd9f206a2e47d00adcdf9622b8a73351f5af3ff /usr.sbin/config/mkmakefile.c
parentf8ceee3cee6452bc381d693c209e8f360047f225 (diff)
Use the err(3) family of functions more consistently.
ok jca, improvements and ok millert, natano
Diffstat (limited to 'usr.sbin/config/mkmakefile.c')
-rw-r--r--usr.sbin/config/mkmakefile.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 7d260aedb58..816bb19887e 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkmakefile.c,v 1.41 2015/01/16 06:40:16 deraadt Exp $ */
+/* $OpenBSD: mkmakefile.c,v 1.42 2016/10/16 17:50:00 tb Exp $ */
/* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */
/*
@@ -80,14 +80,12 @@ mkmakefile(void)
machine, machine);
ifname = sourcepath(buf);
if ((ifp = fopen(ifname, "r")) == NULL) {
- (void)fprintf(stderr, "config: cannot read %s: %s\n",
- ifname, strerror(errno));
+ warn("cannot read %s", ifname);
free(ifname);
return (1);
}
if ((ofp = fopen("Makefile", "w")) == NULL) {
- (void)fprintf(stderr, "config: cannot write Makefile: %s\n",
- strerror(errno));
+ warn("cannot write Makefile");
free(ifname);
(void)fclose(ifp);
return (1);
@@ -125,9 +123,7 @@ mkmakefile(void)
goto wrerror;
}
if (ferror(ifp)) {
- (void)fprintf(stderr,
- "config: error reading %s (at line %d): %s\n",
- ifname, lineno, strerror(errno));
+ warn("error reading %s (at line %d)", ifname, lineno);
goto bad;
}
if (fclose(ofp)) {
@@ -138,8 +134,7 @@ mkmakefile(void)
free(ifname);
return (0);
wrerror:
- (void)fprintf(stderr, "config: error writing Makefile: %s\n",
- strerror(errno));
+ warn("error writing Makefile");
bad:
if (ofp != NULL)
(void)fclose(ofp);