summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2019-06-28 13:33:55 +0000
committerderaadt <deraadt@openbsd.org>2019-06-28 13:33:55 +0000
commitd6719668f9b347383dcf1dcec6611149e83fc332 (patch)
tree97cd669d75b5aaec1292362d0d3cf16b966bc359 /usr.sbin/config
parentWhen system calls indicate an error they return -1, not some arbitrary (diff)
downloadwireguard-openbsd-d6719668f9b347383dcf1dcec6611149e83fc332.tar.xz
wireguard-openbsd-d6719668f9b347383dcf1dcec6611149e83fc332.zip
fputc/fputs return EOF on error
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/mkioconf.c26
-rw-r--r--usr.sbin/config/mkmakefile.c34
-rw-r--r--usr.sbin/config/mkswap.c8
3 files changed, 34 insertions, 34 deletions
diff --git a/usr.sbin/config/mkioconf.c b/usr.sbin/config/mkioconf.c
index 9d6c419395a..c173100ed8c 100644
--- a/usr.sbin/config/mkioconf.c
+++ b/usr.sbin/config/mkioconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkioconf.c,v 1.37 2017/09/27 15:14:51 deraadt Exp $ */
+/* $OpenBSD: mkioconf.c,v 1.38 2019/06/28 13:33:55 deraadt Exp $ */
/* $NetBSD: mkioconf.c,v 1.41 1996/11/11 14:18:49 mycroft Exp $ */
/*
@@ -68,7 +68,7 @@ static int emitroots(FILE *);
* NEWLINE can only be used in the emitXXX functions.
* In most cases it can be subsumed into an fprintf.
*/
-#define NEWLINE if (putc('\n', fp) < 0) return (1)
+#define NEWLINE if (putc('\n', fp) == EOF) return (1)
int
mkioconf(void)
@@ -133,7 +133,7 @@ emithdr(FILE *ofp)
} else {
if (fputs("\
#include <sys/param.h>\n\
-#include <sys/device.h>\n", ofp) < 0)
+#include <sys/device.h>\n", ofp) == EOF)
return (1);
}
return (0);
@@ -337,14 +337,14 @@ struct cfdata cfdata[] = {\n\
if (fprintf(fp, "%s%s", v == 0 ? "" : "|",
i->i_parents[v]->i_name) < 0)
return (1);
- if (v == 0 && fputs("root", fp) < 0)
+ if (v == 0 && fputs("root", fp) == EOF)
return (1);
a = i->i_atattr;
for (nv = a->a_locs, v = 0; nv != NULL; nv = nv->nv_next, v++)
if (fprintf(fp, " %s %s",
nv->nv_name, i->i_locs[v]) < 0)
return (1);
- if (fputs(" */\n", fp) < 0)
+ if (fputs(" */\n", fp) == EOF)
return (-1);
/* then the actual defining line */
@@ -383,7 +383,7 @@ struct cfdata cfdata[] = {\n\
return (1);
if (fprintf(fp, " {0},\n {0},\n {0},\n {0},\n") < 0)
return (1);
- return (fputs(" {(struct cfattach *)-1}\n};\n", fp) < 0);
+ return (fputs(" {(struct cfattach *)-1}\n};\n", fp) == EOF);
}
/*
@@ -395,7 +395,7 @@ emitroots(FILE *fp)
struct devi **p, *i;
int cnt = 0;
- if (fputs("\nshort cfroots[] = {\n", fp) < 0)
+ if (fputs("\nshort cfroots[] = {\n", fp) == EOF)
return (1);
for (p = packed; (i = *p) != NULL; p++) {
if (i->i_at != NULL)
@@ -408,7 +408,7 @@ emitroots(FILE *fp)
return (1);
cnt++;
}
- if (fputs("\t-1\n};\n", fp) < 0)
+ if (fputs("\t-1\n};\n", fp) == EOF)
return (1);
return(fprintf(fp, "\nint cfroots_size = %d;\n", cnt+1) < 0);
@@ -424,13 +424,13 @@ emitpseudo(FILE *fp)
struct devbase *d;
int cnt = 0, umax;
- if (fputs("\n/* pseudo-devices */\n", fp) < 0)
+ if (fputs("\n/* pseudo-devices */\n", fp) == EOF)
return (1);
for (i = allpseudo; i != NULL; i = i->i_next)
if (fprintf(fp, "extern void %sattach(int);\n",
i->i_base->d_name) < 0)
return (1);
- if (fputs("\nchar *pdevnames[] = {\n", fp) < 0)
+ if (fputs("\nchar *pdevnames[] = {\n", fp) == EOF)
return (1);
for (i = allpseudo; i != NULL; i = i->i_next) {
d = i->i_base;
@@ -438,11 +438,11 @@ emitpseudo(FILE *fp)
return (1);
cnt++;
}
- if (fputs("};\n", fp) < 0)
+ if (fputs("};\n", fp) == EOF)
return (1);
if (fprintf(fp, "\nint pdevnames_size = %d;\n", cnt) < 0)
return (1);
- if (fputs("\nstruct pdevinit pdevinit[] = {\n", fp) < 0)
+ if (fputs("\nstruct pdevinit pdevinit[] = {\n", fp) == EOF)
return (1);
for (i = allpseudo; i != NULL; i = i->i_next) {
d = i->i_base;
@@ -453,5 +453,5 @@ emitpseudo(FILE *fp)
d->d_name, umax) < 0)
return (1);
}
- return (fputs("\t{ NULL, 0 }\n};\n", fp) < 0);
+ return (fputs("\t{ NULL, 0 }\n};\n", fp) == EOF);
}
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 012ff4ff337..47e26257e15 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkmakefile.c,v 1.46 2019/04/01 07:04:38 deraadt Exp $ */
+/* $OpenBSD: mkmakefile.c,v 1.47 2019/06/28 13:33:55 deraadt Exp $ */
/* $NetBSD: mkmakefile.c,v 1.34 1997/02/02 21:12:36 thorpej Exp $ */
/*
@@ -96,7 +96,7 @@ mkmakefile(void)
while (fgets(line, sizeof(line), ifp) != NULL) {
lineno++;
if (line[0] != '%') {
- if (fputs(line, ofp) < 0)
+ if (fputs(line, ofp) == EOF)
goto wrerror;
continue;
}
@@ -126,7 +126,7 @@ mkmakefile(void)
warn("error reading %s (at line %d)", ifname, lineno);
goto bad;
}
- if (fclose(ofp)) {
+ if (fclose(ofp) == EOF) {
ofp = NULL;
goto wrerror;
}
@@ -244,7 +244,7 @@ emitdefs(FILE *fp)
struct nvlist *nv;
char *sp;
- if (fputs("IDENT=", fp) < 0)
+ if (fputs("IDENT=", fp) == EOF)
return (1);
sp = "";
for (nv = options; nv != NULL; nv = nv->nv_next) {
@@ -257,7 +257,7 @@ emitdefs(FILE *fp)
return 1;
sp = " ";
}
- if (putc('\n', fp) < 0)
+ if (putc('\n', fp) == EOF)
return (1);
if (fprintf(fp, "PARAM=-DMAXUSERS=%d\n", maxusers) < 0)
return (1);
@@ -278,12 +278,12 @@ emitreconfig(FILE *fp)
{
if (fputs("\n"
".PHONY: config\n"
- "config:\n", fp) < 0)
+ "config:\n", fp) == EOF)
return (1);
if (fprintf(fp, "\tcd %s && config ", startdir) < 0)
return (1);
if (pflag) {
- if (fputs("-p ", fp) < 0)
+ if (fputs("-p ", fp) == EOF)
return (1);
}
if (sflag) {
@@ -308,7 +308,7 @@ emitobjs(FILE *fp)
int lpos, len, sp;
const char *fpath;
- if (fputs("OBJS=", fp) < 0)
+ if (fputs("OBJS=", fp) == EOF)
return (1);
sp = '\t';
lpos = 7;
@@ -319,7 +319,7 @@ emitobjs(FILE *fp)
return (1);
len = strlen(fi->fi_base) + 3;
if (lpos + len > 72) {
- if (fputs(" \\\n", fp) < 0)
+ if (fputs(" \\\n", fp) == EOF)
return (1);
sp = '\t';
lpos = 7;
@@ -334,7 +334,7 @@ emitobjs(FILE *fp)
continue;
len = strlen(oi->oi_path) + 3;
if (lpos + len > 72) {
- if (fputs(" \\\n", fp) < 0)
+ if (fputs(" \\\n", fp) == EOF)
return (1);
sp = '\t';
lpos = 7;
@@ -344,7 +344,7 @@ emitobjs(FILE *fp)
lpos += len + 1;
sp = ' ';
}
- if (putc('\n', fp) < 0)
+ if (putc('\n', fp) == EOF)
return (1);
return (0);
}
@@ -386,7 +386,7 @@ emitfiles(FILE *fp, int suffix)
if (*fpath != '/')
len += 3; /* "$S/" */
if (lpos + len > 72) {
- if (fputs(" \\\n", fp) < 0)
+ if (fputs(" \\\n", fp) == EOF)
return (1);
sp = '\t';
lpos = 7;
@@ -397,7 +397,7 @@ emitfiles(FILE *fp, int suffix)
lpos += len + 1;
sp = ' ';
}
- if (putc('\n', fp) < 0)
+ if (putc('\n', fp) == EOF)
return (1);
return (0);
}
@@ -474,13 +474,13 @@ emitload(FILE *fp)
const char *nm, *swname;
int first;
- if (fputs("all:", fp) < 0)
+ if (fputs("all:", fp) == EOF)
return (1);
for (cf = allcf; cf != NULL; cf = cf->cf_next) {
if (fprintf(fp, " %s", cf->cf_name) < 0)
return (1);
}
- if (fputs("\n\n", fp) < 0)
+ if (fputs("\n\n", fp) == EOF)
return (1);
for (first = 1, cf = allcf; cf != NULL; cf = cf->cf_next) {
nm = cf->cf_name;
@@ -489,7 +489,7 @@ emitload(FILE *fp)
if (fprintf(fp, "%s: ${SYSTEM_DEP} swap%s.o", nm, swname) < 0)
return (1);
if (first) {
- if (fputs(" vers.o", fp) < 0)
+ if (fputs(" vers.o", fp) == EOF)
return (1);
first = 0;
}
@@ -507,7 +507,7 @@ emitload(FILE *fp)
if (fprintf(fp, "$S/conf/swapgeneric.c\n") < 0)
return (1);
}
- if (fputs("\t${NORMAL_C}\n\n", fp) < 0)
+ if (fputs("\t${NORMAL_C}\n\n", fp) == EOF)
return (1);
if (fprintf(fp, "new%s:\n", nm) < 0)
diff --git a/usr.sbin/config/mkswap.c b/usr.sbin/config/mkswap.c
index 645340c5e4f..d16f632bd91 100644
--- a/usr.sbin/config/mkswap.c
+++ b/usr.sbin/config/mkswap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mkswap.c,v 1.17 2019/02/05 02:17:32 deraadt Exp $ */
+/* $OpenBSD: mkswap.c,v 1.18 2019/06/28 13:33:55 deraadt Exp $ */
/* $NetBSD: mkswap.c,v 1.5 1996/08/31 20:58:27 mycroft Exp $ */
/*
@@ -96,7 +96,7 @@ mkoneswap(struct config *cf)
if (fputs("\
#include <sys/param.h>\n\
#include <sys/conf.h>\n\
-#include <sys/systm.h>\n\n", fp) < 0)
+#include <sys/systm.h>\n\n", fp) == EOF)
goto wrerror;
nv = cf->cf_root;
if (fprintf(fp, "dev_t\trootdev = %s;\t/* %s */\n",
@@ -106,13 +106,13 @@ mkoneswap(struct config *cf)
if (fprintf(fp, "dev_t\tdumpdev = %s;\t/* %s */\n",
mkdevstr(nv->nv_int), nv->nv_str) < 0)
goto wrerror;
- if (fputs("\nstruct\tswdevt swdevt[] = {\n", fp) < 0)
+ if (fputs("\nstruct\tswdevt swdevt[] = {\n", fp) == EOF)
goto wrerror;
for (nv = cf->cf_swap; nv != NULL; nv = nv->nv_next)
if (fprintf(fp, "\t{ %s,\t0 },\t/* %s */\n",
mkdevstr(nv->nv_int), nv->nv_str) < 0)
goto wrerror;
- if (fputs("\t{ NODEV, 0 }\n};\n\n", fp) < 0)
+ if (fputs("\t{ NODEV, 0 }\n};\n\n", fp) == EOF)
goto wrerror;
mountroot =
cf->cf_root->nv_str == s_nfs ? "nfs_mountroot" : "dk_mountroot";