initctl: fix error handling

Fixes a bug introduced by cc090ca7fe (v246).
This commit is contained in:
Yu Watanabe
2025-03-19 01:32:12 +09:00
parent a0272b8356
commit 59cb9b12ab

View File

@@ -318,8 +318,7 @@ static int run(int argc, char *argv[]) {
n = sd_listen_fds(true);
if (n < 0)
return log_error_errno(errno,
"Failed to read listening file descriptors from environment: %m");
return log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
if (n <= 0 || n > SERVER_FD_MAX)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),