summaryrefslogtreecommitdiff
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
parent210f400c2f86223b592e3c43ba8ec1e96cdeec91 (diff)
Fix gethostname() usage.
deraadt@ ok
-rw-r--r--libexec/talkd/talkd.c6
-rw-r--r--usr.bin/ftp/util.c6
-rw-r--r--usr.bin/netstat/inet.c8
-rw-r--r--usr.bin/netstat/inet6.c8
-rw-r--r--usr.bin/w/w.c6
-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
9 files changed, 29 insertions, 29 deletions
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index 01c960238a3..d00e5a32a26 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: talkd.c,v 1.9 2001/07/08 21:18:12 deraadt Exp $ */
+/* $OpenBSD: talkd.c,v 1.10 2002/02/19 18:38:02 mpech Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)talkd.c 5.8 (Berkeley) 2/26/91";*/
-static char rcsid[] = "$Id: talkd.c,v 1.9 2001/07/08 21:18:12 deraadt Exp $";
+static char rcsid[] = "$Id: talkd.c,v 1.10 2002/02/19 18:38:02 mpech Exp $";
#endif /* not lint */
/*
@@ -85,7 +85,7 @@ main(argc, argv)
exit(1);
}
openlog("talkd", LOG_PID, LOG_DAEMON);
- if (gethostname(hostname, sizeof (hostname) - 1) < 0) {
+ if (gethostname(hostname, sizeof (hostname)) < 0) {
syslog(LOG_ERR, "gethostname: %m");
_exit(1);
}
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index fe8d815efdd..4600bc5e8bf 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.27 2002/02/16 21:27:46 millert Exp $ */
+/* $OpenBSD: util.c,v 1.28 2002/02/19 18:38:01 mpech Exp $ */
/* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */
/*
@@ -35,7 +35,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.27 2002/02/16 21:27:46 millert Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.28 2002/02/19 18:38:01 mpech Exp $";
#endif /* not lint */
/*
@@ -242,7 +242,7 @@ login(host, user, pass)
else
user = pw->pw_name;
}
- gethostname(hostname, MAXHOSTNAMELEN);
+ gethostname(hostname, sizeof(hostname));
#ifndef DONT_CHEAT_ANONPASS
/*
* Every anonymous FTP server I've encountered
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 4c53d483109..bd028ecd526 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.56 2002/02/16 21:27:50 millert Exp $ */
+/* $OpenBSD: inet.c,v 1.57 2002/02/19 18:38:02 mpech Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
-static char *rcsid = "$OpenBSD: inet.c,v 1.56 2002/02/16 21:27:50 millert Exp $";
+static char *rcsid = "$OpenBSD: inet.c,v 1.57 2002/02/19 18:38:02 mpech Exp $";
#endif
#endif /* not lint */
@@ -642,12 +642,12 @@ inetname(inp)
static char line[50];
struct hostent *hp;
struct netent *np;
- static char domain[MAXHOSTNAMELEN + 1];
+ static char domain[MAXHOSTNAMELEN];
static int first = 1;
if (first && !nflag) {
first = 0;
- if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
+ if (gethostname(domain, sizeof(domain)) == 0 &&
(cp = strchr(domain, '.')))
(void) strcpy(domain, cp + 1);
else
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 538b597795d..aed8ffcc1b2 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet6.c,v 1.18 2002/02/16 21:27:50 millert Exp $ */
+/* $OpenBSD: inet6.c,v 1.19 2002/02/19 18:38:02 mpech Exp $ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
* Copyright (c) 1983, 1988, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
-/*__RCSID("$OpenBSD: inet6.c,v 1.18 2002/02/16 21:27:50 millert Exp $");*/
+/*__RCSID("$OpenBSD: inet6.c,v 1.19 2002/02/19 18:38:02 mpech Exp $");*/
/*__RCSID("KAME Id: inet6.c,v 1.10 2000/02/09 10:49:31 itojun Exp");*/
#endif
#endif /* not lint */
@@ -1046,7 +1046,7 @@ inet6name(in6p)
char *cp;
static char line[NI_MAXHOST];
struct hostent *hp;
- static char domain[MAXHOSTNAMELEN + 1];
+ static char domain[MAXHOSTNAMELEN];
static int first = 1;
char hbuf[NI_MAXHOST];
struct sockaddr_in6 sin6;
@@ -1058,7 +1058,7 @@ inet6name(in6p)
if (first && !nflag) {
first = 0;
- if (gethostname(domain, MAXHOSTNAMELEN) == 0 &&
+ if (gethostname(domain, sizeof(domain)) == 0 &&
(cp = index(domain, '.')))
(void) strcpy(domain, cp + 1);
else
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 7b99d2a9ccc..f3acb102a78 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.35 2002/02/16 21:27:58 millert Exp $ */
+/* $OpenBSD: w.c,v 1.36 2002/02/19 18:38:02 mpech Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94";
#else
-static char *rcsid = "$OpenBSD: w.c,v 1.35 2002/02/16 21:27:58 millert Exp $";
+static char *rcsid = "$OpenBSD: w.c,v 1.36 2002/02/19 18:38:02 mpech Exp $";
#endif
#endif /* not lint */
@@ -306,7 +306,7 @@ main(argc, argv)
}
if (!nflag) {
- if (gethostname(domain, sizeof(domain) - 1) < 0 ||
+ if (gethostname(domain, sizeof(domain)) < 0 ||
(p = strchr(domain, '.')) == 0)
domain[0] = '\0';
else {
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);
}