From nobody Fri Mar 03 05:31:26 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 4PSc685Rqnz3wjGd; Fri, 3 Mar 2023 05:31:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PSc6850Msz3p97; Fri, 3 Mar 2023 05:31:44 +0000 (UTC) (envelope-from kevans@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677821504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ja/iKAuahA949v8SxsQtNpfK2KS3sOQmkcYPQJ9LOIY=; b=m0C6z4ZYbRMhj10d+iMoGJi62QnbBjwOd/TZ1/bzCquxfiNCgV4gew38mWd5LYCOW9CrB9 DCsd75YwAdHaFk2NqJo0zi5uwHpZuWygwJGbJBMdyTA2uR6Vt6CIqt/cMG4TlmGSF3gvvc 5VFhvWDEXxdqEEGfNABC+EXB7FbVgEzrfnZ7t4SoPCdLVfMkro6/eTA90ehQAEzMpG4oxU BWU4nsOlC+cfizCVQQCmRxpCXLB5eM/D1R9YXkFTdgZQRJV+8edLQ3RSnkGJ9hty27WSAj U0Ml9+QKDf+QQ37J1f9NNSDLwIPL776X3ftsVLZw6OjViOhfEZVBBDX9tXBTYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677821504; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ja/iKAuahA949v8SxsQtNpfK2KS3sOQmkcYPQJ9LOIY=; b=eUjrIag91dUwyvjAk0JmF5Jh/1uJicY4j2Od3+nYdxdv77imMDYWvSki4L5tizVpuiLsvq XxItpTr4yx/q0/F4Lq1R64BjhhxFjKan1tGAqmknd77TsMTst1qgfgDjkjxUFrHSYVL4BC zwD0aBet9X8CaftR/Q5/VMtKYVl2So6I9ehMqm/wBgcULdP3VdtYWszkROxFPgsGW+nDf4 xamf+siwms8yEjl6oka0Tygr4Llu+27eiLtax+qWjVPumI/miNcoOOe32LQjVFFfDBVpSX ONUXCit4lExpo6tM3EUZr2oizrjd40/rjnPkIUY0tH9AEZkrALuKypHuUeTEgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677821504; a=rsa-sha256; cv=none; b=NKx1MWEhWQa/ncIjeCl6E0twYpoJWJA3LdH5OelbhMMjO/+FgLAiOPo5zBB9jPoZqMNLEr 6kaU+2oQYzOh6XcL7XTUwvjsdyO+0zU63onvGJ6QXIgRtAMXRAi4cpEct6TWxFHnOA4PFr bPKTP0uQRUPtrjPXQqqwQVajLjr5aE6XHynrKbX1ck0wyHDJ/EoMMEdGoIa/0oLy2JeECU UIhBO+sZiGgowK2jVicvNlrsVJ9ofqVDv8mTdhawb8egAJtyPyQwR6RdxsLcEFQhiOtFof f2pepQ8YMAHfNmXXC5vjLfOkLgKkQUS4PRGc0s4YBhQfp+iJqbexpKLoFkumqg== Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PSc683vgWzljw; Fri, 3 Mar 2023 05:31:44 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f173.google.com with SMTP id a65so396217qkg.13; Thu, 02 Mar 2023 21:31:44 -0800 (PST) X-Gm-Message-State: AO0yUKUszrqB8atRPFb613c+6wSFFhEDMSdP7M2DzZap8+mvg7oJ7URw FQRRbat9IxaAMgTOBoITt/DZ9MexU/Kq+NSXE8s= X-Google-Smtp-Source: AK7set8ShPpQC0hepI52HJ5isuBd2r7SyHgpftz/7jbH1FArFecy3/AvJpgnrMJx7CormhN7mriNDGdV3Y2aGkPcQZ0= X-Received: by 2002:ae9:efd1:0:b0:742:a566:d40c with SMTP id d200-20020ae9efd1000000b00742a566d40cmr49857qkg.14.1677821504085; Thu, 02 Mar 2023 21:31:44 -0800 (PST) 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 References: <202303030517.3235HRmW019673@gitrepo.freebsd.org> In-Reply-To: <202303030517.3235HRmW019673@gitrepo.freebsd.org> From: Kyle Evans Date: Thu, 2 Mar 2023 23:31:26 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: d6c398d882b6 - main - daemon: add braces to while loop To: Kyle Evans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-ThisMailContainsUnwantedMimeParts: N On Thu, Mar 2, 2023 at 11:17=E2=80=AFPM Kyle Evans wro= te: > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dd6c398d882b61e02e6f061be81= 886b9675f3fb5c > > commit d6c398d882b61e02e6f061be81886b9675f3fb5c > Author: Ihor Antonov > AuthorDate: 2023-03-03 05:17:02 +0000 > Commit: Kyle Evans > CommitDate: 2023-03-03 05:17:02 +0000 > > daemon: add braces to while loop > > Reviewed by: kevans > Pull Request: https://github.com/freebsd/freebsd-src/pull/672 > --- Sorry, caught this once but forgot to fix it again when I redid the branch pre-commit. Obviously there's more than just brace-loop here. :-( pfd -> pipe_fd rename for clarity. Thanks, Kyle Evans > 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 =3D NULL; > int ch =3D 0; > int keep_cur_workdir =3D 1; > - int pfd[2] =3D { -1, -1 }; > + int pipe_fd[2] =3D { -1, -1 }; > int restart =3D 0; > int stdmask =3D STDOUT_FILENO | STDERR_FILENO; > struct log_params logparams =3D { > @@ -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) =3D=3D -1= ) { > + if (dup2(pipe_fd[1], STDERR_FILENO) =3D= =3D -1) { > err(1, "dup2"); > } > } > if (stdmask & STDOUT_FILENO) { > - if (dup2(pfd[1], STDOUT_FILENO) =3D=3D -1= ) { > + if (dup2(pipe_fd[1], STDOUT_FILENO) =3D= =3D -1) { > err(1, "dup2"); > } > } > - if (pfd[1] !=3D STDERR_FILENO && > - pfd[1] !=3D STDOUT_FILENO) { > - close(pfd[1]); > + if (pipe_fd[1] !=3D STDERR_FILENO && > + pipe_fd[1] !=3D STDOUT_FILENO) { > + close(pipe_fd[1]); > } > } > execvp(argv[0], argv); > @@ -424,8 +424,8 @@ restart: > warn("sigprocmask"); > goto exit; > } > - close(pfd[1]); > - pfd[1] =3D -1; > + close(pipe_fd[1]); > + pipe_fd[1] =3D -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 =3D !listen_child(pfd[0], &logparams); > + child_eof =3D !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] =3D -1; > + close(pipe_fd[0]); > + pipe_fd[0] =3D -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(); > }