diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-29 02:19:03 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-05-29 02:19:03 +0000 |
commit | 094a195998845eafe6706858aa02b3fb7d0c45e5 (patch) | |
tree | 16e7904def58671522dc191d76a062f15147df52 /usr.sbin | |
parent | 3d87b184ce5b9a7782f4cb309aed4424030d5206 (diff) |
Delete blocking/unblocking of signals, as the handlers now just set flags
that are tested by the main loop.
ok jca@ deraadt@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/rbootd/Makefile | 4 | ||||
-rw-r--r-- | usr.sbin/rbootd/parseconf.c | 17 | ||||
-rw-r--r-- | usr.sbin/rbootd/rbootd.c | 15 | ||||
-rw-r--r-- | usr.sbin/rbootd/utils.c | 19 |
4 files changed, 7 insertions, 48 deletions
diff --git a/usr.sbin/rbootd/Makefile b/usr.sbin/rbootd/Makefile index 77e1a2c92fa..74cb35dbc04 100644 --- a/usr.sbin/rbootd/Makefile +++ b/usr.sbin/rbootd/Makefile @@ -1,7 +1,9 @@ -# $OpenBSD: Makefile,v 1.5 2015/10/26 10:34:18 tedu Exp $ +# $OpenBSD: Makefile,v 1.6 2016/05/29 02:19:02 guenther Exp $ PROG= rbootd SRCS= bpf.c conf.c parseconf.c rbootd.c rmpproto.c utils.c MAN= rbootd.8 +CFLAGS+=-Wall -Wextra + .include <bsd.prog.mk> diff --git a/usr.sbin/rbootd/parseconf.c b/usr.sbin/rbootd/parseconf.c index 583f8ad32f4..4739c15d9eb 100644 --- a/usr.sbin/rbootd/parseconf.c +++ b/usr.sbin/rbootd/parseconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parseconf.c,v 1.12 2015/01/16 06:40:19 deraadt Exp $ */ +/* $OpenBSD: parseconf.c,v 1.13 2016/05/29 02:19:02 guenther Exp $ */ /* $NetBSD: parseconf.c,v 1.4 1995/10/06 05:12:16 thorpej Exp $ */ /* @@ -47,8 +47,6 @@ #include <ctype.h> #include <dirent.h> -#include <fcntl.h> -#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -76,7 +74,6 @@ ParseConfig(void) { char line[C_LINELEN], *cp, *bcp; int i, j, linecnt = 0; - sigset_t mask, omask; u_int8_t *addr; CLIENT *client; FILE *fp; @@ -93,17 +90,6 @@ ParseConfig(void) } /* - * We've got to block SIGHUP to prevent reconfiguration while - * dealing with the linked list of Clients. This can be done - * when actually linking the new client into the list, but - * this could have unexpected results if the server was HUP'd - * whilst reconfiguring. Hence, it is done here. - */ - sigemptyset(&mask); - sigaddset(&mask, SIGHUP); - sigprocmask(SIG_BLOCK, &mask, &omask); - - /* * GETSTR positions `bcp' at the start of the current token, * and null terminates it. `cp' is positioned at the start * of the next token. spaces & commas are separators. @@ -206,7 +192,6 @@ ParseConfig(void) } (void) fclose(fp); /* close config file */ - sigprocmask(SIG_SETMASK, &omask, NULL); /* reset signal mask */ return(1); /* return success */ } diff --git a/usr.sbin/rbootd/rbootd.c b/usr.sbin/rbootd/rbootd.c index 1c7d1d78aa1..5c1dbee3edc 100644 --- a/usr.sbin/rbootd/rbootd.c +++ b/usr.sbin/rbootd/rbootd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rbootd.c,v 1.30 2016/03/16 15:41:11 krw Exp $ */ +/* $OpenBSD: rbootd.c,v 1.31 2016/05/29 02:19:02 guenther Exp $ */ /* $NetBSD: rbootd.c,v 1.5 1995/10/06 05:12:17 thorpej Exp $ */ /* @@ -45,10 +45,8 @@ #include <sys/time.h> -#include <ctype.h> #include <err.h> #include <errno.h> -#include <fcntl.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> @@ -83,7 +81,6 @@ int main(int argc, char *argv[]) { int c, fd; - sigset_t hmask, omask; struct passwd *pw; struct pollfd pfd[1]; @@ -170,9 +167,6 @@ main(int argc, char *argv[]) /* * Initial configuration. */ - sigemptyset(&hmask); - sigaddset(&hmask, SIGHUP); - sigprocmask(SIG_BLOCK, &hmask, &omask); /* prevent reconfig's */ if (GetBootFiles() == 0) /* get list of boot files */ DoExit(); if (ParseConfig() == 0) /* parse config file */ @@ -194,8 +188,6 @@ main(int argc, char *argv[]) } endpwent(); - sigprocmask(SIG_SETMASK, &omask, NULL); /* allow reconfig's */ - /* * Main loop: receive a packet, determine where it came from, * and if we service this host, call routine to handle request. @@ -244,8 +236,6 @@ main(int argc, char *argv[]) if (DbgFp != NULL) /* display packet */ DispPkt(&rconn,DIR_RCVD); - sigprocmask(SIG_BLOCK, &hmask, &omask); - /* * If we do not restrict service, set the * client to NULL (ProcessPacket() handles @@ -259,13 +249,10 @@ main(int argc, char *argv[]) syslog(LOG_INFO, "%s: boot packet ignored", EnetStr(&rconn)); - sigprocmask(SIG_SETMASK, &omask, NULL); continue; } ProcessPacket(&rconn,client); - - sigprocmask(SIG_SETMASK, &omask, NULL); } } } diff --git a/usr.sbin/rbootd/utils.c b/usr.sbin/rbootd/utils.c index 41a8dfd3b2f..28a9654137b 100644 --- a/usr.sbin/rbootd/utils.c +++ b/usr.sbin/rbootd/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.14 2015/08/20 22:39:29 deraadt Exp $ */ +/* $OpenBSD: utils.c,v 1.15 2016/05/29 02:19:02 guenther Exp $ */ /* $NetBSD: utils.c,v 1.5.2.1 1995/11/14 08:45:46 thorpej Exp $ */ /* @@ -43,8 +43,6 @@ * Author: Jeff Forys, University of Utah CSS */ -#include <fcntl.h> -#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -75,21 +73,10 @@ DispPkt(RMPCONN *rconn, int direct) "\t\tRetCode:%u Offset:%x SessID:%x\n"; struct tm *tmp; struct rmp_packet *rmp; - int i, omask; + int i; u_int32_t t; time_t tim; - /* - * Since we will be working with RmpConns as well as DbgFp, we - * must block signals that can affect either. - */ - omask = sigblock(sigmask(SIGHUP)|sigmask(SIGUSR1)|sigmask(SIGUSR2)); - - if (DbgFp == NULL) { /* sanity */ - (void) sigsetmask(omask); - return; - } - /* display direction packet is going using '>>>' or '<<<' */ fputs((direct==DIR_RCVD)?"<<< ":(direct==DIR_SENT)?">>> ":"", DbgFp); @@ -173,8 +160,6 @@ DispPkt(RMPCONN *rconn, int direct) } (void) fputc('\n', DbgFp); (void) fflush(DbgFp); - - (void) sigsetmask(omask); /* reset old signal mask */ } |