diff options
author | steve <steve@FreeBSD.org> | 1997-06-29 19:00:29 +0000 |
---|---|---|
committer | steve <steve@FreeBSD.org> | 1997-06-29 19:00:29 +0000 |
commit | 0d992ff3138ae20de7a6f94dd7a46d15618900ad (patch) | |
tree | b7f9efb7b5727705d2c745d83fd97780dc95e4c9 | |
parent | 8d3c561e32236d0061cc1de5ec7a4224d7ec85f4 (diff) | |
download | FreeBSD-src-0d992ff3138ae20de7a6f94dd7a46d15618900ad.zip FreeBSD-src-0d992ff3138ae20de7a6f94dd7a46d15618900ad.tar.gz |
Merge conflicts and make this compile -Wall clean.
-rw-r--r-- | libexec/rbootd/Makefile | 9 | ||||
-rw-r--r-- | libexec/rbootd/bpf.c | 25 | ||||
-rw-r--r-- | libexec/rbootd/conf.c | 6 | ||||
-rw-r--r-- | libexec/rbootd/defs.h | 2 | ||||
-rw-r--r-- | libexec/rbootd/parseconf.c | 15 | ||||
-rw-r--r-- | libexec/rbootd/pathnames.h | 2 | ||||
-rw-r--r-- | libexec/rbootd/rbootd.8 | 6 | ||||
-rw-r--r-- | libexec/rbootd/rbootd.c | 94 | ||||
-rw-r--r-- | libexec/rbootd/rmp.h | 2 | ||||
-rw-r--r-- | libexec/rbootd/rmp_var.h | 2 | ||||
-rw-r--r-- | libexec/rbootd/rmpproto.c | 6 | ||||
-rw-r--r-- | libexec/rbootd/utils.c | 7 |
12 files changed, 45 insertions, 131 deletions
diff --git a/libexec/rbootd/Makefile b/libexec/rbootd/Makefile index dfb0870..0cc5ac2 100644 --- a/libexec/rbootd/Makefile +++ b/libexec/rbootd/Makefile @@ -1,13 +1,8 @@ -# @(#)Makefile 8.1 (Berkeley) 6/4/93 -# $Id$ +# from: @(#)Makefile 8.1 (Berkeley) 6/4/93 +# $Id: Makefile,v 1.7 1997/02/22 14:21:57 peter Exp $ PROG= rbootd SRCS= bpf.c conf.c parseconf.c rbootd.c rmpproto.c utils.c MAN8= rbootd.8 -# XXX BROKEN: afterinstall: -XXXafterinstall: - (cd ${.CURDIR}/bootdir && ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} \ - -m 444 * ${DESTDIR}/usr/mdec/) - .include <bsd.prog.mk> diff --git a/libexec/rbootd/bpf.c b/libexec/rbootd/bpf.c index 41ec1f7..6633b48 100644 --- a/libexec/rbootd/bpf.c +++ b/libexec/rbootd/bpf.c @@ -38,15 +38,15 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)bpf.c 8.1 (Berkeley) 6/4/93 - * $Id$ + * from: @(#)bpf.c 8.1 (Berkeley) 6/4/93 + * $Id: bpf.c,v 1.6 1997/02/22 14:21:57 peter Exp $ * - * Utah $Hdr: bpf.c 3.1 92/07/06$ + * From: Utah Hdr: bpf.c 3.1 92/07/06 * Author: Jeff Forys, University of Utah CSS */ #ifndef lint -static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93"; +static const char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ #include <sys/param.h> @@ -70,7 +70,7 @@ static char sccsid[] = "@(#)bpf.c 8.1 (Berkeley) 6/4/93"; static int BpfFd = -1; static unsigned BpfLen = 0; -static u_char *BpfPkt = NULL; +static u_int8_t *BpfPkt = NULL; /* ** BpfOpen -- Open and initialize a BPF device. @@ -147,14 +147,9 @@ BpfOpen() #endif ifr.ifr_addr.sa_family = AF_UNSPEC; bcopy(&RmpMcastAddr[0], (char *)&ifr.ifr_addr.sa_data[0], RMP_ADDRLEN); - if (ioctl(BpfFd, SIOCADDMULTI, (caddr_t)&ifr) < 0) { - syslog(LOG_WARNING, - "bpf: can't add mcast addr (%m), setting promiscuous mode"); - - if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) < 0) { - syslog(LOG_ERR, "bpf: can't set promiscuous mode: %m"); - Exit(0); - } + if (ioctl(BpfFd, BIOCPROMISC, (caddr_t)0) < 0) { + syslog(LOG_ERR, "bpf: can't set promiscuous mode: %m"); + Exit(0); } /* @@ -165,7 +160,7 @@ BpfOpen() Exit(0); } if (BpfPkt == NULL) - BpfPkt = (u_char *)malloc(BpfLen); + BpfPkt = (u_int8_t *)malloc(BpfLen); if (BpfPkt == NULL) { syslog(LOG_ERR, "bpf: out of memory (%u bytes for bpfpkt)", @@ -314,7 +309,7 @@ BpfRead(rconn, doread) int doread; { register int datlen, caplen, hdrlen; - static u_char *bp = NULL, *ep = NULL; + static u_int8_t *bp = NULL, *ep = NULL; int cc; /* diff --git a/libexec/rbootd/conf.c b/libexec/rbootd/conf.c index 51ad23b..58da9f0 100644 --- a/libexec/rbootd/conf.c +++ b/libexec/rbootd/conf.c @@ -1,5 +1,3 @@ -/* $NetBSD: conf.c,v 1.5 1995/10/06 05:12:13 thorpej Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). @@ -41,14 +39,14 @@ * SUCH DAMAGE. * * from: @(#)conf.c 8.1 (Berkeley) 6/4/93 + * $Id$ * * From: Utah Hdr: conf.c 3.1 92/07/06 * Author: Jeff Forys, University of Utah CSS */ #ifndef lint -/*static char sccsid[] = "@(#)conf.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$NetBSD: conf.c,v 1.5 1995/10/06 05:12:13 thorpej Exp $"; +static const char sccsid[] = "@(#)conf.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ #include <sys/param.h> diff --git a/libexec/rbootd/defs.h b/libexec/rbootd/defs.h index 9ff814e..6edde9b 100644 --- a/libexec/rbootd/defs.h +++ b/libexec/rbootd/defs.h @@ -1,5 +1,3 @@ -/* $NetBSD: defs.h,v 1.5 1995/10/06 05:12:14 thorpej Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). diff --git a/libexec/rbootd/parseconf.c b/libexec/rbootd/parseconf.c index 7d7bce2..93c9411 100644 --- a/libexec/rbootd/parseconf.c +++ b/libexec/rbootd/parseconf.c @@ -38,15 +38,15 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)parseconf.c 8.1 (Berkeley) 6/4/93 - * $Id$ + * from: @(#)parseconf.c 8.1 (Berkeley) 6/4/93 + * $Id: parseconf.c,v 1.5 1997/02/22 14:21:57 peter Exp $ * - * Utah $Hdr: parseconf.c 3.1 92/07/06$ + * From: Utah Hdr: parseconf.c 3.1 92/07/06 * Author: Jeff Forys, University of Utah CSS */ #ifndef lint -static char sccsid[] = "@(#)parseconf.c 8.1 (Berkeley) 6/4/93"; +static const char sccsid[] = "@(#)parseconf.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ #include <sys/param.h> @@ -83,7 +83,7 @@ ParseConfig() { FILE *fp; CLIENT *client; - u_char *addr; + u_int8_t *addr; char line[C_LINELEN]; register char *cp, *bcp; register int i, j; @@ -242,13 +242,12 @@ ParseConfig() ** Warnings: ** - The return value points to a static buffer; it must ** be copied if it's to be saved. -** - For speed, we assume a u_char consists of 8 bits. */ -u_char * +u_int8_t * ParseAddr(str) char *str; { - static u_char addr[RMP_ADDRLEN]; + static u_int8_t addr[RMP_ADDRLEN]; register char *cp; register unsigned i; register int part, subpart; diff --git a/libexec/rbootd/pathnames.h b/libexec/rbootd/pathnames.h index 381864a..56b9deb 100644 --- a/libexec/rbootd/pathnames.h +++ b/libexec/rbootd/pathnames.h @@ -1,5 +1,3 @@ -/* $NetBSD: pathnames.h,v 1.3 1995/08/21 17:05:15 thorpej Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). diff --git a/libexec/rbootd/rbootd.8 b/libexec/rbootd/rbootd.8 index dae0c6d..23c37c5 100644 --- a/libexec/rbootd/rbootd.8 +++ b/libexec/rbootd/rbootd.8 @@ -37,10 +37,10 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)rbootd.8 8.2 (Berkeley) 12/11/93 -.\" $Id: rbootd.8,v 1.5 1997/02/22 14:21:58 peter Exp $ +.\" from: @(#)rbootd.8 8.2 (Berkeley) 12/11/93 +.\" $Id: rbootd.8,v 1.6 1997/06/23 04:02:13 steve Exp $ .\" -.\" Utah $Hdr: rbootd.man 3.1 92/07/06$ +.\" Utah Hdr: rbootd.man 3.1 92/07/06 .\" Author: Jeff Forys, University of Utah CSS .\" .Dd December 11, 1993 diff --git a/libexec/rbootd/rbootd.c b/libexec/rbootd/rbootd.c index ad3b44a..3b98ccf 100644 --- a/libexec/rbootd/rbootd.c +++ b/libexec/rbootd/rbootd.c @@ -38,28 +38,27 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)rbootd.c 8.2 (Berkeley) 2/22/94 - * $Id: rbootd.c,v 1.5 1997/02/22 14:21:58 peter Exp $ + * from: @(#)rbootd.c 8.1 (Berkeley) 6/4/93 + * $Id: rbootd.c,v 1.6 1997/03/28 15:48:14 imp Exp $ * - * Utah $Hdr: rbootd.c 3.1 92/07/06$ + * From: Utah Hdr: rbootd.c 3.1 92/07/06 * Author: Jeff Forys, University of Utah CSS */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)rbootd.c 8.2 (Berkeley) 2/22/94"; +static const char sccsid[] = "@(#)rbootd.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ #include <sys/param.h> -#include <sys/ioctl.h> #include <sys/time.h> - #include <ctype.h> +#include <err.h> #include <errno.h> #include <fcntl.h> #include <signal.h> @@ -70,19 +69,7 @@ static char sccsid[] = "@(#)rbootd.c 8.2 (Berkeley) 2/22/94"; #include <unistd.h> #include "defs.h" - -/* fd mask macros (backward compatibility with 4.2BSD) */ -#ifndef FD_SET -#ifdef notdef -typedef struct fd_set { /* this should already be in 4.2 */ - int fds_bits[1]; -} fd_set; -#endif -#define FD_ZERO(p) ((p)->fds_bits[0] = 0) -#define FD_SET(n, p) ((p)->fds_bits[0] |= (1 << (n))) -#define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1 << (n))) -#define FD_ISSET(n, p) ((p)->fds_bits[0] & (1 << (n))) -#endif +extern char *__progname; /* from crt0.o */ int main(argc, argv) @@ -93,11 +80,6 @@ main(argc, argv) fd_set rset; /* - * Find what name we are running under. - */ - ProgName = (ProgName = rindex(argv[0],'/')) ? ++ProgName : *argv; - - /* * Close any open file descriptors. * Temporarily leave stdin & stdout open for `-d', * and stderr open for any pre-syslog error messages. @@ -130,9 +112,8 @@ main(argc, argv) if (ConfigFile == NULL) ConfigFile = argv[optind]; else { - fprintf(stderr, - "%s: too many config files (`%s' ignored)\n", - ProgName, argv[optind]); + warnx("too many config files (`%s' ignored)\n", + argv[optind]); } } @@ -144,57 +125,16 @@ main(argc, argv) (void) signal(SIGUSR1, SIG_IGN); /* dont muck w/DbgFp */ (void) signal(SIGUSR2, SIG_IGN); + (void) fclose(stderr); /* finished with it */ } else { - (void) fclose(stdin); /* dont need these */ - (void) fclose(stdout); - - /* - * Fork off a child to do the work & exit. - */ - switch(fork()) { - case -1: /* fork failed */ - fprintf(stderr, "%s: ", ProgName); - perror("fork"); - Exit(0); - case 0: /* this is the CHILD */ - break; - default: /* this is the PARENT */ - _exit(0); - } - - /* - * Try to disassociate from the current tty. - */ - { - char *devtty = "/dev/tty"; - int i; - - if ((i = open(devtty, O_RDWR)) < 0) { - /* probably already disassociated */ - if (setpgrp(0, 0) < 0) { - fprintf(stderr, "%s: ", ProgName); - perror("setpgrp"); - } - } else { - if (ioctl(i, (u_long)TIOCNOTTY, (char *)0) < 0){ - fprintf(stderr, "%s: ", ProgName); - perror("ioctl"); - } - (void) close(i); - } - } + if (daemon(0, 0)) + err(1, "can't detach from terminal"); (void) signal(SIGUSR1, DebugOn); (void) signal(SIGUSR2, DebugOff); } - (void) fclose(stderr); /* finished with it */ - -#ifdef SYSLOG4_2 - openlog(ProgName, LOG_PID); -#else - openlog(ProgName, LOG_PID, LOG_DAEMON); -#endif + openlog(__progname, LOG_PID, LOG_DAEMON); /* * If no interface was specified, get one now. @@ -238,7 +178,7 @@ main(argc, argv) FILE *fp; if ((fp = fopen(PidFile, "w")) != NULL) { - (void) fprintf(fp, "%d\n", MyPid); + (void) fprintf(fp, "%d\n", (int) MyPid); (void) fclose(fp); } else { syslog(LOG_WARNING, "fopen: failed (%s)", PidFile); @@ -287,13 +227,11 @@ main(argc, argv) r = rset; if (RmpConns == NULL) { /* timeout isnt necessary */ - nsel = select(maxfds, &r, (fd_set *)0, (fd_set *)0, - (struct timeval *)0); + nsel = select(maxfds, &r, NULL, NULL, NULL); } else { timeout.tv_sec = RMP_TIMEOUT; timeout.tv_usec = 0; - nsel = select(maxfds, &r, (fd_set *)0, (fd_set *)0, - &timeout); + nsel = select(maxfds, &r, NULL, NULL, &timeout); } if (nsel < 0) { diff --git a/libexec/rbootd/rmp.h b/libexec/rbootd/rmp.h index 4a686ef..c4285c9 100644 --- a/libexec/rbootd/rmp.h +++ b/libexec/rbootd/rmp.h @@ -1,5 +1,3 @@ -/* $NetBSD: rmp.h,v 1.4 1995/10/06 05:12:18 thorpej Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). diff --git a/libexec/rbootd/rmp_var.h b/libexec/rbootd/rmp_var.h index c60b6dd..7da0fdd 100644 --- a/libexec/rbootd/rmp_var.h +++ b/libexec/rbootd/rmp_var.h @@ -1,5 +1,3 @@ -/* $NetBSD: rmp_var.h,v 1.8 1995/11/14 08:41:44 thorpej Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). diff --git a/libexec/rbootd/rmpproto.c b/libexec/rbootd/rmpproto.c index 12a6f5c..9120718 100644 --- a/libexec/rbootd/rmpproto.c +++ b/libexec/rbootd/rmpproto.c @@ -1,5 +1,3 @@ -/* $NetBSD: rmpproto.c,v 1.7 1996/02/01 21:27:46 mycroft Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). @@ -41,14 +39,14 @@ * SUCH DAMAGE. * * from: @(#)rmpproto.c 8.1 (Berkeley) 6/4/93 + * $Id$ * * From: Utah Hdr: rmpproto.c 3.1 92/07/06 * Author: Jeff Forys, University of Utah CSS */ #ifndef lint -/*static char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$NetBSD: rmpproto.c,v 1.7 1996/02/01 21:27:46 mycroft Exp $"; +static const char sccsid[] = "@(#)rmpproto.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ #include <sys/param.h> diff --git a/libexec/rbootd/utils.c b/libexec/rbootd/utils.c index 5d37a25..8defac0 100644 --- a/libexec/rbootd/utils.c +++ b/libexec/rbootd/utils.c @@ -1,5 +1,3 @@ -/* $NetBSD: utils.c,v 1.6 1995/11/14 08:41:47 thorpej Exp $ */ - /* * Copyright (c) 1988, 1992 The University of Utah and the Center * for Software Science (CSS). @@ -41,17 +39,18 @@ * SUCH DAMAGE. * * from: @(#)utils.c 8.1 (Berkeley) 6/4/93 + * $Id$ * * From: Utah Hdr: utils.c 3.1 92/07/06 * Author: Jeff Forys, University of Utah CSS */ #ifndef lint -/*static char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93";*/ -static char rcsid[] = "$NetBSD: utils.c,v 1.6 1995/11/14 08:41:47 thorpej Exp $"; +static const char sccsid[] = "@(#)utils.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint */ #include <sys/param.h> +#include <sys/time.h> #include <fcntl.h> #include <signal.h> |