diff options
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/init/init.c | 14 | ||||
-rw-r--r-- | sbin/ipfw/ipfw2.c | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c index 99041c9..e6f567c 100644 --- a/sbin/init/init.c +++ b/sbin/init/init.c @@ -1499,6 +1499,15 @@ static state_func_t death(void) { session_t *sp; + int block, blocked; + size_t len; + + /* Temporarily block suspend. */ + len = sizeof(blocked); + block = 1; + if (sysctlbyname("kern.suspend_blocked", &blocked, &len, + &block, sizeof(block)) == -1) + blocked = 0; /* * Also revoke the TTY here. Because runshutdown() may reopen @@ -1515,6 +1524,11 @@ death(void) /* Try to run the rc.shutdown script within a period of time */ runshutdown(); + /* Unblock suspend if we blocked it. */ + if (!blocked) + sysctlbyname("kern.suspend_blocked", NULL, NULL, + &blocked, sizeof(blocked)); + return (state_func_t) death_single; } diff --git a/sbin/ipfw/ipfw2.c b/sbin/ipfw/ipfw2.c index 8cc92e1..11ccb9f 100644 --- a/sbin/ipfw/ipfw2.c +++ b/sbin/ipfw/ipfw2.c @@ -3001,7 +3001,7 @@ ipfw_add(char *av[]) action->opcode = O_NAT; action->len = F_INSN_SIZE(ipfw_insn_nat); CHECK_ACTLEN; - if (_substrcmp(*av, "global") == 0) { + if (*av != NULL && _substrcmp(*av, "global") == 0) { action->arg1 = 0; av++; break; |