aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Antonov <ihor@antonovs.family>2023-03-03 05:17:02 +0000
committerKyle Evans <kevans@FreeBSD.org>2023-03-03 05:17:02 +0000
commitbc43a9a7157a8249a492ee3efd8589369dd94228 (patch)
tree20604a4c9bb772d7e24755079aa10f950bc0e2d8
parent75f61ca92098941f73020f46674f0c40db7270fb (diff)
downloadsrc-bc43a9a7157a8249a492ee3efd8589369dd94228.tar.gz
src-bc43a9a7157a8249a492ee3efd8589369dd94228.zip
daemon: change type of listen_child() to C99 bool
Reviewed by: kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/672
-rw-r--r--usr.sbin/daemon/daemon.c20
1 files 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;
}
/*