summaryrefslogtreecommitdiff
path: root/bin/hostname/hostname.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /bin/hostname/hostname.c
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (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 'bin/hostname/hostname.c')
-rw-r--r--bin/hostname/hostname.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/bin/hostname/hostname.c b/bin/hostname/hostname.c
index 6a63d7f08bf..e9c6454fb36 100644
--- a/bin/hostname/hostname.c
+++ b/bin/hostname/hostname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hostname.c,v 1.8 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: hostname.c,v 1.9 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: hostname.c,v 1.10 1995/09/07 06:28:40 jtc Exp $ */
/*
@@ -30,13 +30,12 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
extern char *__progname;
@@ -46,7 +45,7 @@ int
main(int argc, char *argv[])
{
int ch, sflag;
- char *p, hostname[MAXHOSTNAMELEN];
+ char *p, hostname[HOST_NAME_MAX+1];
sflag = 0;
while ((ch = getopt(argc, argv, "s")) != -1)