- 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 * Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@ -7,7 +7,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
# include <sys/ioctl.h> # include <sys/ioctl.h>
@ -266,10 +266,10 @@ init()
# ifdef LOG # ifdef LOG
# ifdef SYSLOG_43 # ifdef SYSLOG_43
openlog("HUNT", LOG_PID, LOG_DAEMON); openlog("huntd", LOG_PID, LOG_DAEMON);
# endif # endif
# ifdef SYSLOG_42 # ifdef SYSLOG_42
openlog("HUNT", LOG_PID); openlog("huntd", LOG_PID);
# endif # endif
# endif # endif
@ -907,7 +907,7 @@ send_stats()
if (errno == EINTR) if (errno == EINTR)
return; return;
# ifdef LOG # ifdef LOG
syslog(LOG_ERR, "accept: %m"); syslog(LOG_WARNING, "accept: %m");
# else # else
warn("accept"); warn("accept");
# endif # endif
@ -916,7 +916,7 @@ send_stats()
fp = fdopen(s, "w"); fp = fdopen(s, "w");
if (fp == NULL) { if (fp == NULL) {
# ifdef LOG # ifdef LOG
syslog(LOG_ERR, "fdopen: %m"); syslog(LOG_WARNING, "fdopen: %m");
# else # else
warn("fdopen"); warn("fdopen");
# endif # 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 * Hunt
* Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
@ -11,7 +11,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include "bsd.h" #include "bsd.h"
@ -123,7 +123,7 @@ faketalk()
# else # else
warn("falktalk: socket"); warn("falktalk: socket");
# endif # endif
_exit(-1); _exit(1);
} }
if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) { if (connect(service, (struct sockaddr *) &des, sizeof(des)) != 0) {
@ -132,7 +132,7 @@ faketalk()
# else # else
warn("faketalk: connect"); warn("faketalk: connect");
# endif # endif
_exit(-1); _exit(1);
} }
if ((f = fdopen(service, "r")) == NULL) { if ((f = fdopen(service, "r")) == NULL) {
# ifdef LOG # ifdef LOG
@ -140,7 +140,7 @@ faketalk()
# else # else
warn("faketalk: fdopen"); warn("faketalk: fdopen");
# endif # endif
_exit(-2); _exit(2);
} }
(void) fgets(buf, BUFSIZ, f); (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. * Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement * All rights reserved. The Berkeley software License Agreement
@ -7,7 +7,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #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 */ #endif /* not lint */
#include "bsd.h" #include "bsd.h"
@ -59,8 +59,13 @@ get_local_name(my_name)
/* look up the address of the local host */ /* look up the address of the local host */
hp = gethostbyname(my_machine_name); hp = gethostbyname(my_machine_name);
if (hp == (struct hostent *) 0) { if (hp == (struct hostent *) 0) {
printf("This machine doesn't exist. Boy, am I confused!\n"); # ifdef LOG
exit(-1); 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); memcpy(&my_machine_addr, hp->h_addr, hp->h_length);
/* find the daemon portal */ /* find the daemon portal */
@ -75,7 +80,7 @@ get_local_name(my_name)
# else # else
perror("This machine doesn't support talk"); perror("This machine doesn't support talk");
# endif # endif
exit(-1); exit(1);
} }
daemon_port = sp->s_port; daemon_port = sp->s_port;
} }