diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2001-12-09 14:58:31 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2001-12-09 14:58:31 +0000 |
commit | 8e4e28ea46653c4928c274a35c168d7eba040f25 (patch) | |
tree | 5c4fe977176d89e554c01b0f9242173c7af0dfe0 /libexec | |
parent | ff83671640be394b9b58a4610c775cdc6e99dffa (diff) |
Do not use stdio functions after a successfull call to daemon(), use
syslog() instead.
ok millert@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/rpc.yppasswdd/rpc.yppasswdd.c | 20 | ||||
-rw-r--r-- | libexec/rpc.yppasswdd/yppasswdd_proc.c | 7 |
2 files changed, 12 insertions, 15 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); |