ypxfrd_main.c (90297) | ypxfrd_main.c (90298) |
---|---|
1/* 2 * Copyright (c) 1995, 1996 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#ifndef lint 34static const char rcsid[] = | 1/* 2 * Copyright (c) 1995, 1996 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33#ifndef lint 34static const char rcsid[] = |
35 "$FreeBSD: head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c 90297 2002-02-06 13:30:31Z des $"; | 35 "$FreeBSD: head/usr.sbin/rpc.ypxfrd/ypxfrd_main.c 90298 2002-02-06 15:26:07Z des $"; |
36#endif /* not lint */ 37 38#include "ypxfrd.h" 39#include <err.h> 40#include <fcntl.h> 41#include <paths.h> 42#include <stdio.h> 43#include <stdlib.h> /* getenv, exit */ --- 31 unchanged lines hidden (view full) --- 75#define _SERVED 1 76#define _SERVING 2 77 78extern int _rpcsvcstate; /* Set when a request is serviced */ 79 80char *progname = "rpc.ypxfrd"; 81char *yp_dir = "/var/yp/"; 82 | 36#endif /* not lint */ 37 38#include "ypxfrd.h" 39#include <err.h> 40#include <fcntl.h> 41#include <paths.h> 42#include <stdio.h> 43#include <stdlib.h> /* getenv, exit */ --- 31 unchanged lines hidden (view full) --- 75#define _SERVED 1 76#define _SERVING 2 77 78extern int _rpcsvcstate; /* Set when a request is serviced */ 79 80char *progname = "rpc.ypxfrd"; 81char *yp_dir = "/var/yp/"; 82 |
83static 84void _msgout(char* msg) | 83static void 84_msgout(char *msg) |
85{ 86#ifdef RPC_SVC_FG 87 if (_rpcpmstart) 88 syslog(LOG_ERR, "%s", msg); 89 else 90 warnx("%s", msg); 91#else 92 syslog(LOG_ERR, "%s", msg); --- 23 unchanged lines hidden (view full) --- 116 _rpcsvcstate = _IDLE; 117 118 (void) signal(SIGALRM, (SIG_PF) closedown); 119 (void) alarm(_RPCSVC_CLOSEDOWN/2); 120} 121 122 123static void | 85{ 86#ifdef RPC_SVC_FG 87 if (_rpcpmstart) 88 syslog(LOG_ERR, "%s", msg); 89 else 90 warnx("%s", msg); 91#else 92 syslog(LOG_ERR, "%s", msg); --- 23 unchanged lines hidden (view full) --- 116 _rpcsvcstate = _IDLE; 117 118 (void) signal(SIGALRM, (SIG_PF) closedown); 119 (void) alarm(_RPCSVC_CLOSEDOWN/2); 120} 121 122 123static void |
124ypxfrd_svc_run() | 124ypxfrd_svc_run(void) |
125{ 126#ifdef FD_SETSIZE 127 fd_set readfds; 128#else 129 int readfds; 130#endif /* def FD_SETSIZE */ 131 extern int forked; 132 int pid; --- 21 unchanged lines hidden (view full) --- 154 default: 155 svc_getreqset(&readfds); 156 if (forked && pid != getpid()) 157 exit(0); 158 } 159 } 160} 161 | 125{ 126#ifdef FD_SETSIZE 127 fd_set readfds; 128#else 129 int readfds; 130#endif /* def FD_SETSIZE */ 131 extern int forked; 132 int pid; --- 21 unchanged lines hidden (view full) --- 154 default: 155 svc_getreqset(&readfds); 156 if (forked && pid != getpid()) 157 exit(0); 158 } 159 } 160} 161 |
162static void reaper(sig) 163 int sig; | 162static void reaper(int sig) |
164{ 165 int status; 166 int saved_errno; 167 168 saved_errno = errno; 169 170 if (sig == SIGHUP) { 171 load_securenets(); --- 8 unchanged lines hidden (view full) --- 180 (void) pmap_unset(YPXFRD_FREEBSD_PROG, YPXFRD_FREEBSD_VERS); 181 exit(0); 182 } 183 184 errno = saved_errno; 185 return; 186} 187 | 163{ 164 int status; 165 int saved_errno; 166 167 saved_errno = errno; 168 169 if (sig == SIGHUP) { 170 load_securenets(); --- 8 unchanged lines hidden (view full) --- 179 (void) pmap_unset(YPXFRD_FREEBSD_PROG, YPXFRD_FREEBSD_VERS); 180 exit(0); 181 } 182 183 errno = saved_errno; 184 return; 185} 186 |
188void usage() | 187void 188usage(void) |
189{ 190 fprintf(stderr, "usage: rpc.ypxfrd [-p path]\n"); 191 exit(0); 192} 193 194int | 189{ 190 fprintf(stderr, "usage: rpc.ypxfrd [-p path]\n"); 191 exit(0); 192} 193 194int |
195main(argc, argv) 196 int argc; 197 char *argv[]; | 195main(int argc, char *argv[]) |
198{ 199 register SVCXPRT *transp = NULL; 200 int sock; 201 int proto = 0; 202 struct sockaddr_in saddr; 203 int asize = sizeof (saddr); 204 int ch; 205 --- 100 unchanged lines hidden --- | 196{ 197 register SVCXPRT *transp = NULL; 198 int sock; 199 int proto = 0; 200 struct sockaddr_in saddr; 201 int asize = sizeof (saddr); 202 int ch; 203 --- 100 unchanged lines hidden --- |