From: deraadt Date: Fri, 16 Jan 2015 00:05:12 +0000 (+0000) Subject: first batch of cleanup to programs based upon the namespace cleanups X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9b2ea7723bfa098cdd2496e40640166ae7e29611;p=openbsd first batch of cleanup to programs based upon the namespace cleanups in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc etc ok millert guenther, some review by doug --- diff --git a/usr.sbin/installboot/bootstrap.c b/usr.sbin/installboot/bootstrap.c index 5ad473e8b50..c2c6ec3cd01 100644 --- a/usr.sbin/installboot/bootstrap.c +++ b/usr.sbin/installboot/bootstrap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bootstrap.c,v 1.5 2014/06/25 18:23:02 tobias Exp $ */ +/* $OpenBSD: bootstrap.c,v 1.6 2015/01/16 00:05:12 deraadt Exp $ */ /* * Copyright (c) 2013 Joel Sing @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include /* DEV_BSIZE */ #include #include #include diff --git a/usr.sbin/installboot/i386_installboot.c b/usr.sbin/installboot/i386_installboot.c index 3512f9a5811..c612f54f1b7 100644 --- a/usr.sbin/installboot/i386_installboot.c +++ b/usr.sbin/installboot/i386_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i386_installboot.c,v 1.6 2014/10/08 04:26:54 deraadt Exp $ */ +/* $OpenBSD: i386_installboot.c,v 1.7 2015/01/16 00:05:12 deraadt Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -37,7 +37,8 @@ #define ELFSIZE 32 -#include +#include /* DEV_BSIZE MAXFRAG */ +#include #include #include #include diff --git a/usr.sbin/installboot/i386_nlist.c b/usr.sbin/installboot/i386_nlist.c index 92a5e670d2d..23d19cc87f6 100644 --- a/usr.sbin/installboot/i386_nlist.c +++ b/usr.sbin/installboot/i386_nlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i386_nlist.c,v 1.1 2014/01/19 02:58:50 jsing Exp $ */ +/* $OpenBSD: i386_nlist.c,v 1.2 2015/01/16 00:05:12 deraadt Exp $ */ /* * Copyright (c) 1989, 1993 * The Regents of the University of California. All rights reserved. @@ -30,7 +30,6 @@ #define ELFSIZE 32 -#include #include #include #include @@ -42,6 +41,8 @@ #include #include +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + static int __elf_fdnlist(int, struct nlist *); static int __elf_is_okay__(Elf_Ehdr *ehdr); @@ -193,7 +194,7 @@ __elf_fdnlist(int fd, struct nlist *list) goto elf_done; while (symsize > 0) { - cc = MIN(symsize, sizeof(sbuf)); + cc = MINIMUM(symsize, sizeof(sbuf)); if (pread(fd, sbuf, cc, (off_t)symoff) != cc) break; symsize -= cc; diff --git a/usr.sbin/installboot/i386_softraid.c b/usr.sbin/installboot/i386_softraid.c index a5a05807387..1be4a7a2892 100644 --- a/usr.sbin/installboot/i386_softraid.c +++ b/usr.sbin/installboot/i386_softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i386_softraid.c,v 1.2 2014/06/09 13:13:48 jsing Exp $ */ +/* $OpenBSD: i386_softraid.c,v 1.3 2015/01/16 00:05:12 deraadt Exp $ */ /* * Copyright (c) 2012 Joel Sing * @@ -15,7 +15,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include /* DEV_BSIZE */ +#include #include #include #include diff --git a/usr.sbin/installboot/softraid.c b/usr.sbin/installboot/softraid.c index 41e755e2bc0..fecf425caf1 100644 --- a/usr.sbin/installboot/softraid.c +++ b/usr.sbin/installboot/softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: softraid.c,v 1.2 2013/12/28 11:26:57 jsing Exp $ */ +/* $OpenBSD: softraid.c,v 1.3 2015/01/16 00:05:12 deraadt Exp $ */ /* * Copyright (c) 2012 Joel Sing * @@ -15,7 +15,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include diff --git a/usr.sbin/installboot/sparc64_installboot.c b/usr.sbin/installboot/sparc64_installboot.c index cc2f48da497..2c831fe1dfb 100644 --- a/usr.sbin/installboot/sparc64_installboot.c +++ b/usr.sbin/installboot/sparc64_installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sparc64_installboot.c,v 1.2 2014/06/09 13:13:48 jsing Exp $ */ +/* $OpenBSD: sparc64_installboot.c,v 1.3 2015/01/16 00:05:12 deraadt Exp $ */ /* * Copyright (c) 2012, 2013 Joel Sing @@ -16,7 +16,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include /* DEV_BSIZE */ #include #include diff --git a/usr.sbin/installboot/sparc64_softraid.c b/usr.sbin/installboot/sparc64_softraid.c index 659d82f699c..76913985efb 100644 --- a/usr.sbin/installboot/sparc64_softraid.c +++ b/usr.sbin/installboot/sparc64_softraid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sparc64_softraid.c,v 1.1 2014/01/19 02:58:50 jsing Exp $ */ +/* $OpenBSD: sparc64_softraid.c,v 1.2 2015/01/16 00:05:12 deraadt Exp $ */ /* * Copyright (c) 2012 Joel Sing * @@ -15,7 +15,7 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include +#include #include #include #include diff --git a/usr.sbin/installboot/util.c b/usr.sbin/installboot/util.c index a8fa8fa085f..05c63e38acd 100644 --- a/usr.sbin/installboot/util.c +++ b/usr.sbin/installboot/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.4 2014/06/09 15:50:08 jsing Exp $ */ +/* $OpenBSD: util.c,v 1.5 2015/01/16 00:05:12 deraadt Exp $ */ /* * Copyright (c) 2014 Joel Sing @@ -16,7 +16,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include @@ -24,9 +23,12 @@ #include #include #include +#include #include "installboot.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + #define BUFSIZE 512 void @@ -56,7 +58,7 @@ filecopy(const char *srcfile, const char *dstfile) err(1, "chmod"); while (sz > 0) { - n = MIN(sz, BUFSIZE); + n = MINIMUM(sz, BUFSIZE); if ((n = read(sfd, buf, n)) == -1) err(1, "read"); sz -= n; diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c index 53e801a6514..9bfaa9a0329 100644 --- a/usr.sbin/snmpd/ber.c +++ b/usr.sbin/snmpd/ber.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ber.c,v 1.27 2014/04/25 06:57:11 blambert Exp $ */ +/* $OpenBSD: ber.c,v 1.28 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2007, 2012 Reyk Floeter @@ -19,7 +19,6 @@ */ #include -#include #include #include @@ -32,6 +31,7 @@ #include "ber.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) #define BER_TYPE_CONSTRUCTED 0x20 /* otherwise primitive */ #define BER_TYPE_SINGLE_MAX 30 @@ -1193,7 +1193,7 @@ ber_readbuf(struct ber *b, void *buf, size_t nbytes) return -1; sz = b->br_rend - b->br_rptr; - len = MIN(nbytes, sz); + len = MINIMUM(nbytes, sz); if (len == 0) { errno = ECANCELED; return (-1); /* end of buffer and parser wants more data */ diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c index 323a95d73df..ca47f5ef20c 100644 --- a/usr.sbin/snmpd/control.c +++ b/usr.sbin/snmpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.27 2014/11/19 10:19:00 blambert Exp $ */ +/* $OpenBSD: control.c,v 1.28 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -18,7 +18,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/snmpd/kroute.c b/usr.sbin/snmpd/kroute.c index a106445ad20..c73be5027a7 100644 --- a/usr.sbin/snmpd/kroute.c +++ b/usr.sbin/snmpd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.29 2014/10/16 04:05:02 deraadt Exp $ */ +/* $OpenBSD: kroute.c,v 1.30 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter @@ -18,7 +18,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include diff --git a/usr.sbin/snmpd/log.c b/usr.sbin/snmpd/log.c index a5ff13832c4..4e82066e843 100644 --- a/usr.sbin/snmpd/log.c +++ b/usr.sbin/snmpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.5 2014/10/25 03:23:49 lteo Exp $ */ +/* $OpenBSD: log.c,v 1.6 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c index 73e823e3f14..8276dfc6e32 100644 --- a/usr.sbin/snmpd/mib.c +++ b/usr.sbin/snmpd/mib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mib.c,v 1.73 2014/11/18 20:54:29 krw Exp $ */ +/* $OpenBSD: mib.c,v 1.74 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2012 Joel Knight @@ -17,10 +17,9 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include /* MAXCOMLEN */ #include -#include #include -#include #include #include #include diff --git a/usr.sbin/snmpd/mps.c b/usr.sbin/snmpd/mps.c index e52f624b6b2..b122bd542fb 100644 --- a/usr.sbin/snmpd/mps.c +++ b/usr.sbin/snmpd/mps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mps.c,v 1.19 2014/11/19 10:19:00 blambert Exp $ */ +/* $OpenBSD: mps.c,v 1.20 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/snmpd/pf.c b/usr.sbin/snmpd/pf.c index b4d162c5531..4cdc82e1164 100644 --- a/usr.sbin/snmpd/pf.c +++ b/usr.sbin/snmpd/pf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf.c,v 1.7 2014/10/08 05:24:42 deraadt Exp $ */ +/* $OpenBSD: pf.c,v 1.8 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2012 Joel Knight @@ -31,7 +31,6 @@ * */ -#include #include #include #include @@ -47,6 +46,7 @@ #include #include #include +#include #include #include "snmpd.h" diff --git a/usr.sbin/snmpd/smi.c b/usr.sbin/snmpd/smi.c index 2eeb802ccff..e41dd37b19f 100644 --- a/usr.sbin/snmpd/smi.c +++ b/usr.sbin/snmpd/smi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smi.c,v 1.16 2014/11/19 10:19:00 blambert Exp $ */ + /* * Copyright (c) 2007, 2008 Reyk Floeter @@ -17,7 +17,6 @@ */ #include -#include #include #include #include @@ -41,12 +40,15 @@ #include #include #include +#include #include #include #include "snmpd.h" #include "mib.h" +#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b)) + extern struct snmpd *env; RB_HEAD(oidtree, oid); @@ -565,7 +567,7 @@ smi_oid_cmp(struct oid *a, struct oid *b) { size_t i; - for (i = 0; i < MIN(a->o_oidlen, b->o_oidlen); i++) + for (i = 0; i < MINIMUM(a->o_oidlen, b->o_oidlen); i++) if (a->o_oid[i] != b->o_oid[i]) return (a->o_oid[i] - b->o_oid[i]); diff --git a/usr.sbin/snmpd/snmpd.c b/usr.sbin/snmpd/snmpd.c index 96044b4d15d..4c16ec42255 100644 --- a/usr.sbin/snmpd/snmpd.c +++ b/usr.sbin/snmpd/snmpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.c,v 1.24 2014/08/18 13:13:42 reyk Exp $ */ +/* $OpenBSD: snmpd.c,v 1.25 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -16,10 +16,10 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include /* nitems */ #include #include #include -#include #include #include diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h index 726911a6cd8..759a313ea2f 100644 --- a/usr.sbin/snmpd/snmpd.h +++ b/usr.sbin/snmpd/snmpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.h,v 1.58 2014/11/19 10:19:00 blambert Exp $ */ +/* $OpenBSD: snmpd.h,v 1.59 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -384,7 +384,7 @@ struct pfr_buffer { struct snmp_message { struct sockaddr_storage sm_ss; socklen_t sm_slen; - char sm_host[MAXHOSTNAMELEN]; + char sm_host[HOST_NAME_MAX+1]; struct ber sm_ber; struct ber_element *sm_req; diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c index 79f2436a71d..0096b24f55f 100644 --- a/usr.sbin/snmpd/snmpe.c +++ b/usr.sbin/snmpd/snmpe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpe.c,v 1.39 2014/11/19 10:19:00 blambert Exp $ */ +/* $OpenBSD: snmpe.c,v 1.40 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2007, 2008, 2012 Reyk Floeter @@ -16,8 +16,8 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include /* nitems */ #include -#include #include #include #include diff --git a/usr.sbin/snmpd/timer.c b/usr.sbin/snmpd/timer.c index 6f4091a59bb..6d9778c8451 100644 --- a/usr.sbin/snmpd/timer.c +++ b/usr.sbin/snmpd/timer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: timer.c,v 1.3 2014/10/25 03:23:49 lteo Exp $ */ +/* $OpenBSD: timer.c,v 1.4 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2008 Reyk Floeter @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c index 1420658236d..2a70c323169 100644 --- a/usr.sbin/snmpd/trap.c +++ b/usr.sbin/snmpd/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.23 2014/11/19 10:19:00 blambert Exp $ */ +/* $OpenBSD: trap.c,v 1.24 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2008 Reyk Floeter @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/snmpd/traphandler.c b/usr.sbin/snmpd/traphandler.c index 08be75451e8..2a2f2c94a0b 100644 --- a/usr.sbin/snmpd/traphandler.c +++ b/usr.sbin/snmpd/traphandler.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traphandler.c,v 1.1 2014/04/25 06:57:11 blambert Exp $ */ +/* $OpenBSD: traphandler.c,v 1.2 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2014 Bret Stephen Lambert * @@ -16,7 +16,7 @@ */ #include -#include +#include /* nitems */ #include #include #include diff --git a/usr.sbin/snmpd/usm.c b/usr.sbin/snmpd/usm.c index 1f440f7bf68..b3343587c1b 100644 --- a/usr.sbin/snmpd/usm.c +++ b/usr.sbin/snmpd/usm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usm.c,v 1.8 2014/11/19 11:14:06 blambert Exp $ */ +/* $OpenBSD: usm.c,v 1.9 2015/01/16 00:05:13 deraadt Exp $ */ /* * Copyright (c) 2012 GeNUA mbH @@ -17,7 +17,6 @@ */ #include -#include #include #include #include diff --git a/usr.sbin/snmpd/util.c b/usr.sbin/snmpd/util.c index e744be40a10..cc172953264 100644 --- a/usr.sbin/snmpd/util.c +++ b/usr.sbin/snmpd/util.c @@ -15,7 +15,6 @@ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include #include #include #include