diff options
author | 2001-12-09 14:58:27 +0000 | |
---|---|---|
committer | 2001-12-09 14:58:27 +0000 | |
commit | bf48b921db3ae7034c34d415f20c82e5ae3bf1dd (patch) | |
tree | 603d8fa6c5ea50cc91c6c52a9537163d0d5b58c8 | |
parent | Do not use stdio functions after a successfull call to daemon(), use (diff) | |
download | wireguard-openbsd-bf48b921db3ae7034c34d415f20c82e5ae3bf1dd.tar.xz wireguard-openbsd-bf48b921db3ae7034c34d415f20c82e5ae3bf1dd.zip |
Do not use stdio functions after a successfull call to daemon(), use
syslog() instead.
ok millert@
-rw-r--r-- | libexec/rpc.yppasswdd/rpc.yppasswdd.c | 20 | ||||
-rw-r--r-- | libexec/rpc.yppasswdd/yppasswdd_proc.c | 7 | ||||
-rw-r--r-- | usr.sbin/wsmoused/wsmoused.c | 7 |
3 files changed, 17 insertions, 17 deletions
diff --git a/libexec/rpc.yppasswdd/rpc.yppasswdd.c b/libexec/rpc.yppasswdd/rpc.yppasswdd.c index 4434b5e8271..33a80bec1c7 100644 --- a/libexec/rpc.yppasswdd/rpc.yppasswdd.c +++ b/libexec/rpc.yppasswdd/rpc.yppasswdd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc.yppasswdd.c,v 1.10 2001/11/27 01:02:48 millert Exp $ */ +/* $OpenBSD: rpc.yppasswdd.c,v 1.11 2001/12/09 14:58:30 miod Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -32,7 +32,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: rpc.yppasswdd.c,v 1.10 2001/11/27 01:02:48 millert Exp $"; +static char rcsid[] = "$OpenBSD: rpc.yppasswdd.c,v 1.11 2001/12/09 14:58:30 miod Exp $"; #endif #include <sys/types.h> @@ -46,6 +46,7 @@ static char rcsid[] = "$OpenBSD: rpc.yppasswdd.c,v 1.10 2001/11/27 01:02:48 mill #include <string.h> #include <pwd.h> #include <util.h> +#include <syslog.h> #include <rpc/rpc.h> #include <rpc/pmap_clnt.h> @@ -116,37 +117,32 @@ main(argc, argv) (void) daemon(0, 0); chdir("/etc"); -/* - freopen("/dev/null", "r", stdin); - freopen("/var/yp/stderr", "w", stderr); - freopen("/var/yp/stdout", "w", stdout); -*/ (void) pmap_unset(YPPASSWDPROG, YPPASSWDVERS); (void) signal(SIGCHLD, sig_child); transp = svcudp_create(RPC_ANYSOCK); if (transp == NULL) { - (void) fprintf(stderr, "cannot create udp service.\n"); + syslog(LOG_ERR, "cannot create udp service"); exit(1); } if (!svc_register(transp, YPPASSWDPROG, YPPASSWDVERS, yppasswddprog_1, IPPROTO_UDP)) { - fprintf(stderr, "unable to register YPPASSWDPROG, YPPASSWDVERS, udp\n"); + syslog(LOG_ERR, "unable to register YPPASSWDPROG, YPPASSWDVERS, udp"); exit(1); } transp = svctcp_create(RPC_ANYSOCK, 0, 0); if (transp == NULL) { - (void) fprintf(stderr, "cannot create tcp service.\n"); + syslog(LOG_ERR, "cannot create tcp service"); exit(1); } if (!svc_register(transp, YPPASSWDPROG, YPPASSWDVERS, yppasswddprog_1, IPPROTO_TCP)) { - fprintf(stderr, "unable to register YPPASSWDPROG, YPPASSWDVERS, tcp\n"); + syslog(LOG_ERR, "unable to register YPPASSWDPROG, YPPASSWDVERS, tcp"); exit(1); } svc_run(); - (void) fprintf(stderr, "svc_run returned\n"); + syslog(LOG_ERR, "svc_run returned"); exit(1); } diff --git a/libexec/rpc.yppasswdd/yppasswdd_proc.c b/libexec/rpc.yppasswdd/yppasswdd_proc.c index 29d2350abb0..bdac32bd040 100644 --- a/libexec/rpc.yppasswdd/yppasswdd_proc.c +++ b/libexec/rpc.yppasswdd/yppasswdd_proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: yppasswdd_proc.c,v 1.5 1997/08/19 07:00:52 niklas Exp $ */ +/* $OpenBSD: yppasswdd_proc.c,v 1.6 2001/12/09 14:58:30 miod Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -32,13 +32,14 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: yppasswdd_proc.c,v 1.5 1997/08/19 07:00:52 niklas Exp $"; +static char rcsid[] = "$OpenBSD: yppasswdd_proc.c,v 1.6 2001/12/09 14:58:30 miod Exp $"; #endif #include <sys/types.h> #include <rpc/rpc.h> #include <stdio.h> #include <string.h> +#include <syslog.h> #include "yppasswd.h" @@ -59,7 +60,7 @@ yppasswdproc_update_1_svc(argp, rqstp, transp) svcerr_systemerr(transp); if (!svc_freeargs(transp, xdr_yppasswd, (caddr_t) argp)) { - (void)fprintf(stderr, "unable to free arguments\n"); + syslog(LOG_ERR, "unable to free arguments"); exit(1); } return ((void *)&res); diff --git a/usr.sbin/wsmoused/wsmoused.c b/usr.sbin/wsmoused/wsmoused.c index 65561f132cf..7a85db2d715 100644 --- a/usr.sbin/wsmoused/wsmoused.c +++ b/usr.sbin/wsmoused/wsmoused.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsmoused.c,v 1.6 2001/11/02 16:19:48 deraadt Exp $ */ +/* $OpenBSD: wsmoused.c,v 1.7 2001/12/09 14:58:27 miod Exp $ */ /* * Copyright (c) 2001 Jean-Baptiste Marchand, Julien Montagne and Jerome Verdon @@ -412,7 +412,7 @@ wsmoused(void) res = ioctl(mouse.cfd, WSDISPLAYIO_WSMOUSED, &event); if (res != 0) { /* the display driver has no getchar() method */ - errx(1, "this display driver has no support for wsmoused\n"); + logerr(1, "this display driver has no support for wsmoused"); } bzero(&action, sizeof(action)); @@ -524,6 +524,9 @@ main(int argc, char **argv) /* default is /dev/wsmouse */ mouse.portname = WSMOUSE_DEV; + if (!nodaemon) + openlog(__progname, LOG_PID, LOG_DAEMON); + for (;;) { signal(SIGINT , terminate); signal(SIGQUIT, terminate); |