From nobody Fri Mar 17 21:01:39 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 4Pdc4h5mGFz3yqfb; Fri, 17 Mar 2023 21:01:40 +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 4Pdc4h1jC2z3qQj; Fri, 17 Mar 2023 21:01:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679086900; 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=Y8m32qozuw8DixSJgNmvOGNfVDt4L5vJGM6EKLweSJw=; b=rSspsmfPA/FxxPg//DKxK5jxXZdAuySrUu98ywJrKu/CT4lkMXJ74w4YRtzaXi0LrFH5jY aFvK5QzqfypwC+nXEZnBg7c/2/RKvsOalXxziOwylHme/If+X6xtT0y6RFizTOcqJX8uLj tX0d/QuVEqcATwEyZM1i5USswZv80H72VIKn+6jqkZJw2ApnidV/qtTqrjXk/Ma8+1LDBm pFyWlEEL10/8rrf/W+rRdrEJ4/e0TZGu4vIJQgWUx3P57zgic6EkfaPnqMF6uX69kGtwWK EOVMsImfstvA147+EI5QGp2M9Yh/42duHTS7xwFuKm6937KTNYK+/abbKK44fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679086900; 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=Y8m32qozuw8DixSJgNmvOGNfVDt4L5vJGM6EKLweSJw=; b=Zr+diXwlNSfv1mZKXDJ1B013mHS6MJyIq5oaS7d+f7FOAkB5e9P13lDpfwE578mC54mkln eL5hOG3akYHhu3bmwTEhEbnP6KwBXeg2SpbGporzOt7erXqs9UtCmXo2aMRZAmhjSupsCC Hw6a1PAcYUJL/Iu3tHt5aZRpoBwdt32in9DxCHM6Jlvhe1X8dKIyhPCBPzPiT9JAjg+V+j gcC2Cv/lcBDASeRKZuhwGpVwaSfJPXloWb2Cj8XM6SPo5Sp3D5Gw2Jq7nBMOCmzrx0og39 ZP9Nx640L6pxC2XBMe5nCJxzyjq6JsEoNUedgsWeXh2le6IFIE2y3+ixa5n47A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679086900; a=rsa-sha256; cv=none; b=dmVhUIGW37N3n0K21TZoNJpiUEl2nwyfmRrxmsWuLp9y9rQl4tVFy2uFR0pL8mHyaXwwvY j3Kh/EsAySXNPQcYHOjm5Ttll5156NgylzNAE8tEP/iOlqP0GryHVJ7wgjPHcJmRZLdtO1 87Dm3Q0vB2fe1RpW9LqxtGAubkoR1v+Dhy4W4QGTUd22G76d3SKLpD+YAmsYkQosiVH7of H1KRRnOgkpzQNXf2s6vyIHAGUrJdooQCTjKaDHfxE9UFZZ4gwNvx7QXHx7eVc9ZirjPp9j jwYrpsf9AwS737jaUlOYHvvoNMwg36TJ7fHFxRYUyKmHn57aPFt7y5ivRbe4pw== 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 4Pdc4h0Lgqzgcx; Fri, 17 Mar 2023 21:01:40 +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 32HL1d0i015265; Fri, 17 Mar 2023 21:01:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32HL1dlf015264; Fri, 17 Mar 2023 21:01:39 GMT (envelope-from git) Date: Fri, 17 Mar 2023 21:01:39 GMT Message-Id: <202303172101.32HL1dlf015264@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: 3f0b048a24bc - stable/13 - daemon: add braces to while loop 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: 3f0b048a24bcd0ea691bca5a012d5c5cd5203f51 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=3f0b048a24bcd0ea691bca5a012d5c5cd5203f51 commit 3f0b048a24bcd0ea691bca5a012d5c5cd5203f51 Author: Ihor Antonov AuthorDate: 2023-03-03 05:17:02 +0000 Commit: Kyle Evans CommitDate: 2023-03-17 21:01:03 +0000 daemon: add braces to while loop Reviewed by: kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/672 (cherry picked from commit d6c398d882b61e02e6f061be81886b9675f3fb5c) --- usr.sbin/daemon/daemon.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 2274a3e253a0..d1efebd0fcc2 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -154,7 +154,7 @@ main(int argc, char *argv[]) const char *user = NULL; int ch = 0; int keep_cur_workdir = 1; - int pfd[2] = { -1, -1 }; + int pipe_fd[2] = { -1, -1 }; int restart = 0; int stdmask = STDOUT_FILENO | STDERR_FILENO; struct log_params logparams = { @@ -360,7 +360,7 @@ main(int argc, char *argv[]) goto exit; } restart: - if (pipe(pfd)) { + if (pipe(pipe_fd)) { err(1, "pipe"); } /* @@ -389,23 +389,23 @@ restart: * and dup'd pipes. */ if (supervision_enabled) { - close(pfd[0]); + close(pipe_fd[0]); if (sigprocmask(SIG_SETMASK, &mask_orig, NULL)) { err(1, "sigprogmask"); } if (stdmask & STDERR_FILENO) { - if (dup2(pfd[1], STDERR_FILENO) == -1) { + if (dup2(pipe_fd[1], STDERR_FILENO) == -1) { err(1, "dup2"); } } if (stdmask & STDOUT_FILENO) { - if (dup2(pfd[1], STDOUT_FILENO) == -1) { + if (dup2(pipe_fd[1], STDOUT_FILENO) == -1) { err(1, "dup2"); } } - if (pfd[1] != STDERR_FILENO && - pfd[1] != STDOUT_FILENO) { - close(pfd[1]); + if (pipe_fd[1] != STDERR_FILENO && + pipe_fd[1] != STDOUT_FILENO) { + close(pipe_fd[1]); } } execvp(argv[0], argv); @@ -424,8 +424,8 @@ restart: warn("sigprocmask"); goto exit; } - close(pfd[1]); - pfd[1] = -1; + close(pipe_fd[1]); + pipe_fd[1] = -1; setproctitle("%s[%d]", title, (int)pid); /* @@ -463,8 +463,9 @@ restart: warn("sigprocmask"); goto exit; } - while (!terminate && !child_gone) + while (!terminate && !child_gone) { sigsuspend(&mask_orig); + } if (sigprocmask(SIG_UNBLOCK, &mask_susp, NULL)) { warn("sigprocmask"); goto exit; @@ -477,7 +478,7 @@ restart: goto exit; } - child_eof = !listen_child(pfd[0], &logparams); + child_eof = !listen_child(pipe_fd[0], &logparams); if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) { warn("sigprocmask"); @@ -493,14 +494,14 @@ restart: goto exit; } if (restart && !terminate) { - close(pfd[0]); - pfd[0] = -1; + close(pipe_fd[0]); + pipe_fd[0] = -1; goto restart; } exit: close(logparams.output_fd); - close(pfd[0]); - close(pfd[1]); + close(pipe_fd[0]); + close(pipe_fd[1]); if (logparams.syslog_enabled) { closelog(); }