From 743b2f8c07f006102cea3da4b6a0c0ecc2c035d8 Mon Sep 17 00:00:00 2001 From: Craig Barnes Date: Sun, 4 Jul 2021 10:31:20 +0100 Subject: [PATCH] client: don't log exit code when --no-wait is used, unless non-zero When the following command is run: footclient --no-wait sh -c 'exit 42' ...the logged message is always: info: client.c:420: exit-code=0 ...because fdm_client() just sends a phony exit code of 0, instead of waiting for the child to exit, as would usually be the case. Logging an incorrect exit code can be somewhat misleading. It seems better to just log nothing, when no useful information is available. --- client.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client.c b/client.c index 7b5cd770..0797ed6e 100644 --- a/client.c +++ b/client.c @@ -417,7 +417,8 @@ main(int argc, char *const *argv) int exit_code; ssize_t rcvd = recv(fd, &exit_code, sizeof(exit_code), 0); - LOG_INFO("exit-code=%d", exit_code); + if (!no_wait || exit_code != 0) + LOG_INFO("exit-code=%d", exit_code); if (rcvd == -1 && errno == EINTR) xassert(aborted);