aboutsummaryrefslogtreecommitdiff
path: root/libexec/talkd/talkd.c
diff options
context:
space:
mode:
authorBrian Somers <brian@FreeBSD.org>1999-04-07 08:27:45 +0000
committerBrian Somers <brian@FreeBSD.org>1999-04-07 08:27:45 +0000
commit9e9a43bdec3ff0ad37e4799b209e0d9513150a6f (patch)
treefb3cb78777ecc17ab82d96b7153224fd483b2d4c /libexec/talkd/talkd.c
parent5b3f0a74e15f741303eb4c823555de3464f8ef7c (diff)
downloadsrc-9e9a43bdec3ff0ad37e4799b209e0d9513150a6f.tar.gz
src-9e9a43bdec3ff0ad37e4799b209e0d9513150a6f.zip
Notes
Diffstat (limited to 'libexec/talkd/talkd.c')
-rw-r--r--libexec/talkd/talkd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libexec/talkd/talkd.c b/libexec/talkd/talkd.c
index bb61f7e50402..72e4a5f50ac6 100644
--- a/libexec/talkd/talkd.c
+++ b/libexec/talkd/talkd.c
@@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)talkd.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: talkd.c,v 1.8 1997/12/02 12:33:42 charnier Exp $";
+ "$Id: talkd.c,v 1.9 1998/12/01 21:12:57 dillon Exp $";
#endif /* not lint */
/*
@@ -73,7 +73,7 @@ int sockt;
int debug = 0;
long lastmsgtime;
-char hostname[MAXHOSTNAMELEN + 1];
+char hostname[MAXHOSTNAMELEN];
#define TIMEOUT 30
#define MAXIDLE 120
@@ -97,10 +97,11 @@ main(argc, argv)
errx(1, "getuid: not super-user");
#endif
openlog("talkd", LOG_PID, LOG_DAEMON);
- if (gethostname(hostname, sizeof (hostname) - 1) < 0) {
+ if (gethostname(hostname, sizeof(hostname) - 1) < 0) {
syslog(LOG_ERR, "gethostname: %m");
_exit(1);
}
+ hostname[sizeof(hostname) - 1] = '\0';
if (chdir(_PATH_DEV) < 0) {
syslog(LOG_ERR, "chdir: %s: %m", _PATH_DEV);
_exit(1);