- openlog "huntd" instead of "HUNT"

- consistently log non-critical errors at LOG_WARNING not LOG_ERR
- consistently use positive numbers for exit() and _exit()
- one warning was using printf() instead of syslog()
This commit is contained in:
lukem 2001-01-09 23:49:54 +00:00
parent 6907c4ded8
commit f8141417ed
3 changed files with 21 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: driver.c,v 1.6 2000/04/14 05:58:03 simonb Exp $ */
/* $NetBSD: driver.c,v 1.7 2001/01/09 23:49:54 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: driver.c,v 1.6 2000/04/14 05:58:03 simonb Exp $");
__RCSID("$NetBSD: driver.c,v 1.7 2001/01/09 23:49:54 lukem Exp $");
#endif /* not lint */
# include <sys/ioctl.h>
@ -266,10 +266,10 @@ init()
# ifdef LOG
# ifdef SYSLOG_43
openlog("HUNT", LOG_PID, LOG_DAEMON);
openlog("huntd", LOG_PID, LOG_DAEMON);
# endif
# ifdef SYSLOG_42
openlog("HUNT", LOG_PID);
openlog("huntd", LOG_PID);
# endif
# endif
@ -907,7 +907,7 @@ send_stats()
if (errno == EINTR)
return;
# ifdef LOG
syslog(LOG_ERR, "accept: %m");
syslog(LOG_WARNING, "accept: %m");
# else
warn("accept");
# endif
@ -916,7 +916,7 @@ send_stats()
fp = fdopen(s, "w");
if (fp == NULL) {
# ifdef LOG
syslog(LOG_ERR, "fdopen: %m");
syslog(LOG_WARNING, "fdopen: %m");
# else
warn("fdopen");
# endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $ */
/* $NetBSD: faketalk.c,v 1.5 2001/01/09 23:49:54 lukem Exp $ */
/*
* Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@ -11,7 +11,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: faketalk.c,v 1.4 1997/10/11 08:13:48 lukem Exp $");
__RCSID("$NetBSD: faketalk.c,v 1.5 2001/01/09 23:49:54 lukem Exp $");
#endif /* not lint */
#include "bsd.h"
@ -123,7 +123,7 @@ faketalk()
# else
warn("falktalk: socket");
# endif
_exit(-1);
_exit(1);
}
if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) {
@ -132,7 +132,7 @@ faketalk()
# else
warn("faketalk: connect");
# endif
_exit(-1);
_exit(1);
}
if ((f = fdopen(service, "r")) == NULL) {
# ifdef LOG
@ -140,7 +140,7 @@ faketalk()
# else
warn("faketalk: fdopen");
# endif
_exit(-2);
_exit(2);
}
(void) fgets(buf, BUFSIZ, f);

View File

@ -1,4 +1,4 @@
/* $NetBSD: get_names.c,v 1.4 2000/07/03 03:57:41 matt Exp $ */
/* $NetBSD: get_names.c,v 1.5 2001/01/09 23:49:54 lukem Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
@ -7,7 +7,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: get_names.c,v 1.4 2000/07/03 03:57:41 matt Exp $");
__RCSID("$NetBSD: get_names.c,v 1.5 2001/01/09 23:49:54 lukem Exp $");
#endif /* not lint */
#include "bsd.h"
@ -59,8 +59,13 @@ get_local_name(my_name)
/* look up the address of the local host */
hp = gethostbyname(my_machine_name);
if (hp == (struct hostent *) 0) {
printf("This machine doesn't exist. Boy, am I confused!\n");
exit(-1);
# ifdef LOG
syslog(LOG_ERR,
"This machine doesn't exist. Boy, am I confused!");
# else
perror("This machine doesn't exist. Boy, am I confused!");
# endif
exit(1);
}
memcpy(&my_machine_addr, hp->h_addr, hp->h_length);
/* find the daemon portal */
@ -75,7 +80,7 @@ get_local_name(my_name)
# else
perror("This machine doesn't support talk");
# endif
exit(-1);
exit(1);
}
daemon_port = sp->s_port;
}