summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMike Pechkin <mpech@cvs.openbsd.org>2002-02-19 18:38:03 +0000
committerMike Pechkin <mpech@cvs.openbsd.org>2002-02-19 18:38:03 +0000
commit1b7ac57ccea5e902a5153d8337c8476912eba485 (patch)
tree9ca417136ca87ef21c45e61611e84d935387b2a5 /usr.sbin
parent210f400c2f86223b592e3c43ba8ec1e96cdeec91 (diff)
Fix gethostname() usage.
deraadt@ ok
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/cron/do_command.c6
-rw-r--r--usr.sbin/rbootd/conf.c6
-rw-r--r--usr.sbin/rbootd/rbootd.c6
-rw-r--r--usr.sbin/timed/timed/timed.c6
4 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/cron/do_command.c b/usr.sbin/cron/do_command.c
index 5f5d1c88b49..e445e95af04 100644
--- a/usr.sbin/cron/do_command.c
+++ b/usr.sbin/cron/do_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: do_command.c,v 1.12 2002/01/09 00:51:00 millert Exp $ */
+/* $OpenBSD: do_command.c,v 1.13 2002/02/19 18:38:02 mpech Exp $ */
/* Copyright 1988,1990,1993,1994 by Paul Vixie
* All rights reserved
*/
@@ -21,7 +21,7 @@
*/
#if !defined(lint) && !defined(LINT)
-static char rcsid[] = "$OpenBSD: do_command.c,v 1.12 2002/01/09 00:51:00 millert Exp $";
+static char rcsid[] = "$OpenBSD: do_command.c,v 1.13 2002/02/19 18:38:02 mpech Exp $";
#endif
#include "cron.h"
@@ -396,7 +396,7 @@ child_process(entry *e, user *u) {
char mailcmd[MAX_COMMAND];
char hostname[MAXHOSTNAMELEN];
- gethostname(hostname, MAXHOSTNAMELEN);
+ gethostname(hostname, sizeof(hostname));
if (snprintf(mailcmd, sizeof mailcmd, MAILFMT,
MAILARG) >= sizeof mailcmd) {
fprintf(stderr, "mailcmd too long\n");
diff --git a/usr.sbin/rbootd/conf.c b/usr.sbin/rbootd/conf.c
index c504c16a348..3a7d334826a 100644
--- a/usr.sbin/rbootd/conf.c
+++ b/usr.sbin/rbootd/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.3 2001/12/01 23:27:23 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.4 2002/02/19 18:38:02 mpech Exp $ */
/* $NetBSD: conf.c,v 1.5 1995/10/06 05:12:13 thorpej Exp $ */
/*
@@ -49,7 +49,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)conf.c 8.1 (Berkeley) 6/4/93";*/
-static char rcsid[] = "$OpenBSD: conf.c,v 1.3 2001/12/01 23:27:23 miod Exp $";
+static char rcsid[] = "$OpenBSD: conf.c,v 1.4 2002/02/19 18:38:02 mpech Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -69,7 +69,7 @@ static char rcsid[] = "$OpenBSD: conf.c,v 1.3 2001/12/01 23:27:23 miod Exp $";
** simplify the boot file search code.
*/
-char MyHost[MAXHOSTNAMELEN+1]; /* host name */
+char MyHost[MAXHOSTNAMELEN]; /* host name */
int DebugFlg = 0; /* set true if debugging */
int BootAny = 0; /* set true if we boot anyone */
diff --git a/usr.sbin/rbootd/rbootd.c b/usr.sbin/rbootd/rbootd.c
index 6492d0c15f6..ce990cebcdd 100644
--- a/usr.sbin/rbootd/rbootd.c
+++ b/usr.sbin/rbootd/rbootd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rbootd.c,v 1.9 2001/12/01 23:27:23 miod Exp $ */
+/* $OpenBSD: rbootd.c,v 1.10 2002/02/19 18:38:02 mpech Exp $ */
/* $NetBSD: rbootd.c,v 1.5 1995/10/06 05:12:17 thorpej Exp $ */
/*
@@ -55,7 +55,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)rbootd.c 8.1 (Berkeley) 6/4/93";*/
-static char rcsid[] = "$OpenBSD: rbootd.c,v 1.9 2001/12/01 23:27:23 miod Exp $";
+static char rcsid[] = "$OpenBSD: rbootd.c,v 1.10 2002/02/19 18:38:02 mpech Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -168,7 +168,7 @@ main(argc, argv)
/*
* Grab our host name and pid.
*/
- if (gethostname(MyHost, MAXHOSTNAMELEN) < 0) {
+ if (gethostname(MyHost, sizeof(MyHost)) < 0) {
syslog(LOG_ERR, "gethostname: %m");
Exit(0);
}
diff --git a/usr.sbin/timed/timed/timed.c b/usr.sbin/timed/timed/timed.c
index a843c718ec9..6a78ff01011 100644
--- a/usr.sbin/timed/timed/timed.c
+++ b/usr.sbin/timed/timed/timed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timed.c,v 1.11 2001/11/23 03:45:51 deraadt Exp $ */
+/* $OpenBSD: timed.c,v 1.12 2002/02/19 18:38:02 mpech Exp $ */
/*-
* Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -44,7 +44,7 @@ static char sccsid[] = "@(#)timed.c 5.1 (Berkeley) 5/11/93";
#endif /* not lint */
#ifdef sgi
-#ident "$Revision: 1.11 $"
+#ident "$Revision: 1.12 $"
#endif /* sgi */
#define TSPTYPES
@@ -298,7 +298,7 @@ main(int argc, char **argv)
if (0 != goodgroup || 0 != goodhosts)
Mflag = 1;
- if (gethostname(hostname, sizeof(hostname) - 1) < 0) {
+ if (gethostname(hostname, sizeof(hostname)) < 0) {
perror("gethostname");
exit(1);
}