mirror of
https://github.com/openbsd/src.git
synced 2025-01-10 06:47:55 -08:00
Fix gethostname() usage.
deraadt@ ok
This commit is contained in:
parent
27b9e9625e
commit
4af80cab53
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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");
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user