n = sd_listen_fds(true);
if (n < 0) {
- log_error("Failed to read listening file descriptors from environment: %s",
- strerror(-n));
+ log_error_errno(n, "Failed to read listening file descriptors from environment: %m");
return n;
}
if (n > 0) {
fd = make_socket_fd(LOG_DEBUG, *address, SOCK_STREAM | (arg_accept*SOCK_CLOEXEC));
if (fd < 0) {
log_open();
- log_error("Failed to open '%s': %s", *address, strerror(-fd));
+ log_error_errno(fd, "Failed to open '%s': %m", *address);
return fd;
}
static int do_accept(const char* name, char **argv, char **envp, int fd) {
_cleanup_free_ char *local = NULL, *peer = NULL;
- int fd2;
+ _cleanup_close_ int fd2 = -1;
fd2 = accept(fd, NULL, NULL);
if (fd2 < 0) {