From nobody Fri Mar 17 21:01:38 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pdc4g0hbbz3yqtV; Fri, 17 Mar 2023 21:01:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pdc4g0F3Qz3qVQ; Fri, 17 Mar 2023 21:01:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679086899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nMiSD0saxnL2kLczMkwME0tzQCWEhDSBTdHPXvkQrt0=; b=dzjaJETfqwR/toR4UPFYPnlJpbWrB9ZbG9TB2/M3cvSme9sMGCzJhQzUuEzAOuJQuqAN0w XmJ1teJA3bq9T2vVCYy/6p2XZx9AXvcNhxyv/+NLswuYRalCHiFMJheZZbTi5URCNxEGyj d3OwT3FMrA6DKaz1Gm+wyyS0/1/P3FpG9RzDC2ISPcEm27k4TG6T9vbRe+cnYqdOLk4iop EhsaanPNpihzhKPXCL5fKzUn39Tie6HY+QQ+AV2ONR1C3sr/RY4GwYs+SW/KcoQRniaI1u jA3cE1VYsRFxvyFynB0a2QLM2kwMtakajDKLCm2i61+GySx2b4lAqFOT0JpnUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679086899; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nMiSD0saxnL2kLczMkwME0tzQCWEhDSBTdHPXvkQrt0=; b=R9FMp0QKpQXl5JybzGhOV9nmH9wEQl7xOuJgH0QqYQq6xt4RBPaEHY+1LkWYvgpXu6onjz LTFkhzvw+dZbTpWcIsZVProwyiO9glwuqDVxNxW36kpc4gveOqSx1ZuJM0hyS2yq8EkXpq xKBchZUbcHxeOsVwT38EWihJw6dcL/+FKlS54zWjedGuik4BJJbgdl5Nc2TwBDEW6jh8S7 6WueG4Xcg8kxQTODsTey/JLFK4uLb7DWWYqsP/16hw6lC7ijDxrCTRRoWw302X+I8Emkkb sFAeaSyq1XiXWs4YHrXkyHi/iMYxZdKKnUj2OqWo4goCV68EKuFg7jiuqeVh7g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679086899; a=rsa-sha256; cv=none; b=hLCkFnk8QyQld3ZAp4P5DLS/0B/LbTKYiQJoAE4hMP3J+4HKsg64lp/VXx2ez/3xMRzIlr bLa4yWXMuedrqYNHT3VdHSKquHH+fCE7FYEv4e6cf36g5szK44uZX20XowP5BYUN+6pYOf mXBR+5tb5WjOIbqeN+3MxE8nh77UdIOSGddV/PWKl2uFGN8t/+xYQPOM6zUFXaZsI+PdFk zebqTxR9hKubEwgKo7elQwmXGq2YgmPmaFT3L5q6De5WOT/+Bll3tTiRcBfpGNKL/tKMb0 PNQHiJxRLfp7uZ8iHr8xWSv/eeZPt1IAsNW7mCZbQ+1kJRNRt06/nuxTx/7QkA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pdc4f6K5xzgcw; Fri, 17 Mar 2023 21:01:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32HL1cGL015246; Fri, 17 Mar 2023 21:01:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32HL1c3x015245; Fri, 17 Mar 2023 21:01:38 GMT (envelope-from git) Date: Fri, 17 Mar 2023 21:01:38 GMT Message-Id: <202303172101.32HL1c3x015245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: bc9d2ee0a7ac - stable/13 - daemon: simplify if/else chain List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bc9d2ee0a7acab55e2625d10f937305b8ba4231a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bc9d2ee0a7acab55e2625d10f937305b8ba4231a commit bc9d2ee0a7acab55e2625d10f937305b8ba4231a Author: Ihor Antonov AuthorDate: 2023-03-03 05:17:02 +0000 Commit: Kyle Evans CommitDate: 2023-03-17 21:01:02 +0000 daemon: simplify if/else chain Reviewed by: kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/672 (cherry picked from commit cd1e6e70d001bea9e9e0220bdfdbd8b5dd9922de) --- usr.sbin/daemon/daemon.c | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 5c636bcd0a03..2274a3e253a0 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -452,22 +452,16 @@ restart: */ if (child_gone && child_eof) { break; - } else if (terminate) { + } + + if (terminate) { goto exit; - } else if (!child_eof) { - if (sigprocmask(SIG_BLOCK, &mask_read, NULL)) { - warn("sigprocmask"); - goto exit; - } - child_eof = !listen_child(pfd[0], &logparams); - if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) { - warn("sigprocmask"); - goto exit; - } - } else { + } + + if (child_eof) { if (sigprocmask(SIG_BLOCK, &mask_susp, NULL)) { warn("sigprocmask"); - goto exit; + goto exit; } while (!terminate && !child_gone) sigsuspend(&mask_orig); @@ -475,7 +469,21 @@ restart: warn("sigprocmask"); goto exit; } + continue; + } + + if (sigprocmask(SIG_BLOCK, &mask_read, NULL)) { + warn("sigprocmask"); + goto exit; } + + child_eof = !listen_child(pfd[0], &logparams); + + if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) { + warn("sigprocmask"); + goto exit; + } + } if (restart && !terminate) { daemon_sleep(restart, 0);