From nobody Fri Mar 03 05:17:24 2023 X-Original-To: dev-commits-src-main@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 4PSbnd1C7sz3whBn; Fri, 3 Mar 2023 05:17:25 +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 4PSbnd0fZFz3lSj; Fri, 3 Mar 2023 05:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677820645; 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=54dB3jxgSUDTaAz+NkZn3f8TNByNEby3u+JAoSsGyEU=; b=eh+tyq/4NGFy5JnofBYFU0HyLZshn1Mb9o+u3cQGjAe2Hovl2jJl4qHW8NXpoSX5x0HY5p Cegs5krvahe/VpnltezCReQfJjnYJ9pd166DCeEhjAsBgrKME0zjSVzaQGRU4vpEd/dqqT owfDyaE5V+e0Pk1vtNoCHic6i45jSIO2lfnSzCg0zgilkJAwFtiitdTKp7Isrl+GpL7ctm BDRvKiFdTPxcGWDzHVVfy+akIkq9fkgDSrf87iGmLs/uvzEso8dEtwsG/JyZeWJTbyxI6S FwlQsR6p1vn6tfjOxpG08tHTu3iakHkmwtadilzGx5+akkXTcl++CaYGjFVSKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677820645; 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=54dB3jxgSUDTaAz+NkZn3f8TNByNEby3u+JAoSsGyEU=; b=YmXT9h+r/NdRy0M7DsUXCwRbU5+cuSX9c/6Yx9d3rCnfPQaMa2ltoCbBkodtfAW8C4dcKs T3liqk1RjTcYIviF9kx/5c8rJUvmNH1kcGVI0T3HX8v1y6OVbSIUbUXGxWwS8DLHZNqEmD sNN6p7xa2NCBGp9RH8Pfm3nLaGWLTEPoPtMAKk0GAIuNVSkcGV3bf28qGKFe/HaArNNgq4 u8qB7D4FCKHsx6IXEvJT9DzBisGccVmETJEbPzT9Z/xt6hZDs4kvdYkKmVtAtleWQEhnia JHXlzBXvJKT+fb70svtjx2DlLbHPASSpVxF6xv9erY+ztanvXv/iTYZWJoXMvA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677820645; a=rsa-sha256; cv=none; b=uiDglUgB8Eh3nrAKZfeHeXldI2fPmywX0b4DZOrQTM5v1X9R8AvcMyXElgW8l4+96Ts1lg ktqJ1rQio1jbUDGl2ss2PB+oX5fFDsCwc+8IqOFlo7aSd8RyniqaeN+Y8Au8mEaXNekMct VriYScF6hkK0xguupD1kIqBCiubZfFFXF8pdvvAzjdjNxMSVoHgQRHRhygCV0GJBSRROAr Dc+D7kuYWXFYY8krDZhRCbT2c6N6Xab4W1h2m3lIR1rGDJVniJc8Kv7Xsijo0VwPxs4jU0 0gQ1Na/+u3e2TnqiSjQWyxPJaSj1sN6/Y8BEBBTT+5rH5fTvidQYAUYqSBQjMA== 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 4PSbnc6fL3zlhX; Fri, 3 Mar 2023 05:17:24 +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 3235HO65019626; Fri, 3 Mar 2023 05:17:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3235HOWW019625; Fri, 3 Mar 2023 05:17:24 GMT (envelope-from git) Date: Fri, 3 Mar 2023 05:17:24 GMT Message-Id: <202303030517.3235HOWW019625@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: bc43a9a7157a - main - daemon: change type of listen_child() to C99 bool List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: bc43a9a7157a8249a492ee3efd8589369dd94228 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=bc43a9a7157a8249a492ee3efd8589369dd94228 commit bc43a9a7157a8249a492ee3efd8589369dd94228 Author: Ihor Antonov AuthorDate: 2023-03-03 05:17:02 +0000 Commit: Kyle Evans CommitDate: 2023-03-03 05:17:02 +0000 daemon: change type of listen_child() to C99 bool Reviewed by: kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/672 --- usr.sbin/daemon/daemon.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/usr.sbin/daemon/daemon.c b/usr.sbin/daemon/daemon.c index 964a77deb0f9..5c636bcd0a03 100644 --- a/usr.sbin/daemon/daemon.c +++ b/usr.sbin/daemon/daemon.c @@ -73,9 +73,9 @@ static void restrict_process(const char *); static void handle_term(int); static void handle_chld(int); static void handle_hup(int); -static int open_log(const char *); +static int open_log(const char *); static void reopen_log(struct log_params *); -static int listen_child(int, struct log_params *); +static bool listen_child(int, struct log_params *); static int get_log_mapping(const char *, const CODE *); static void open_pid_files(const char *, const char *, struct pidfh **, struct pidfh **); @@ -146,13 +146,13 @@ main(int argc, char *argv[]) { bool supervision_enabled = false; bool log_reopen = false; + bool child_eof = false; char *p = NULL; const char *child_pidfile = NULL; const char *parent_pidfile = NULL; const char *title = NULL; const char *user = NULL; int ch = 0; - int child_eof = 0; int keep_cur_workdir = 1; int pfd[2] = { -1, -1 }; int restart = 0; @@ -580,10 +580,10 @@ restrict_process(const char *user) * We try to collect whole lines terminated by '\n'. Otherwise we collect a * full buffer, and then output it. * - * Return value of 0 is assumed to mean EOF or error, and 1 indicates to + * Return value of false is assumed to mean EOF or error, and true indicates to * continue reading. */ -static int +static bool listen_child(int fd, struct log_params *logpar) { static unsigned char buf[LBUF_SIZE]; @@ -617,18 +617,18 @@ listen_child(int fd, struct log_params *logpar) } /* Wait until the buffer is full. */ if (bytes_read < LBUF_SIZE - 1) { - return 1; + return true; } do_output(buf, bytes_read, logpar); bytes_read = 0; - return 1; + return true; } else if (rv == -1) { /* EINTR should trigger another read. */ if (errno == EINTR) { - return 1; + return true; } else { warn("read"); - return 0; + return false; } } /* Upon EOF, we have to flush what's left of the buffer. */ @@ -636,7 +636,7 @@ listen_child(int fd, struct log_params *logpar) do_output(buf, bytes_read, logpar); bytes_read = 0; } - return 0; + return false; } /*