diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-01-16 06:40:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-01-16 06:40:24 +0000 |
commit | 315054f4737a39489e0a14f3a92bff61f1592832 (patch) | |
tree | 62bf010653374ce09b6beb4dfa0414a91457233b /usr.sbin/ypserv/mkalias | |
parent | 79e3d817585ca08a91e30ad14abe43e2ab70295f (diff) |
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch
to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change
MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where
sensible to avoid pulling in the pollution. These are the files confirmed
through binary verification.
ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'usr.sbin/ypserv/mkalias')
-rw-r--r-- | usr.sbin/ypserv/mkalias/mkalias.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/usr.sbin/ypserv/mkalias/mkalias.c b/usr.sbin/ypserv/mkalias/mkalias.c index 71e9470e2bb..e15b0388ae1 100644 --- a/usr.sbin/ypserv/mkalias/mkalias.c +++ b/usr.sbin/ypserv/mkalias/mkalias.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkalias.c,v 1.26 2013/12/05 14:18:54 jca Exp $ */ +/* $OpenBSD: mkalias.c,v 1.27 2015/01/16 06:40:23 deraadt Exp $ */ /* * Copyright (c) 1997 Mats O Jansson <moj@stacken.kth.se> @@ -33,7 +33,6 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/param.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/nameser.h> @@ -146,10 +145,10 @@ main(int argc, char *argv[]) datum key, val; DBM *new_db = NULL; static char mapname[] = "ypdbXXXXXXXXXX"; - char db_mapname[MAXPATHLEN], db_outfile[MAXPATHLEN]; - char db_tempname[MAXPATHLEN]; + char db_mapname[PATH_MAX], db_outfile[PATH_MAX]; + char db_tempname[PATH_MAX]; char user[4096], host[4096]; /* XXX: DB bsize = 4096 in ypdb.c */ - char myname[MAXHOSTNAMELEN], datestr[11], *slash; + char myname[HOST_NAME_MAX+1], datestr[11], *slash; while ((ch = getopt(argc, argv, "Edensuv")) != -1) switch (ch) { @@ -196,7 +195,7 @@ main(int argc, char *argv[]) } if (output != NULL) { - if (strlen(output) + strlen(YPDB_SUFFIX) > MAXPATHLEN) { + if (strlen(output) + strlen(YPDB_SUFFIX) > PATH_MAX) { errx(1, "%s: file name too long", output); /* NOTREACHED */ } @@ -213,7 +212,7 @@ main(int argc, char *argv[]) /* note: output is now directory where map goes ! */ if (strlen(output) + strlen(mapname) + - strlen(YPDB_SUFFIX) > MAXPATHLEN) { + strlen(YPDB_SUFFIX) > PATH_MAX) { errx(1, "%s: directory name too long", output); /* NOTREACHED */ } |