when we get SIGHUP, close conffd so it's reopened (and rewound).
authortedu <tedu@openbsd.org>
Tue, 6 Feb 2018 20:38:47 +0000 (20:38 +0000)
committertedu <tedu@openbsd.org>
Tue, 6 Feb 2018 20:38:47 +0000 (20:38 +0000)
problem and early fix by anton

usr.sbin/rebound/rebound.c

index 63688d5..ecc1ef6 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: rebound.c,v 1.91 2017/08/22 15:47:13 deraadt Exp $ */
+/* $OpenBSD: rebound.c,v 1.92 2018/02/06 20:38:47 tedu Exp $ */
 /*
  * Copyright (c) 2015 Ted Unangst <tedu@openbsd.org>
  *
@@ -922,8 +922,6 @@ monitorloop(int ud, int ld, int ud6, int ld6, const char *confname)
                        case EVFILT_VNODE:
                                /* config file changed */
                                logmsg(LOG_INFO, "config changed, reloading");
-                               close(conffd);
-                               conffd = -1;
                                sleep(1);
                                raise(SIGHUP);
                                break;
@@ -931,6 +929,8 @@ monitorloop(int ud, int ld, int ud6, int ld6, const char *confname)
                                if (kev.ident == SIGHUP) {
                                        /* signaled. kill child. */
                                        logmsg(LOG_INFO, "received HUP, restarting");
+                                       close(conffd);
+                                       conffd = -1;
                                        hupped = 1;
                                        if (childdead)
                                                goto doublebreak;