mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 06:25:37 +03:00
activate: use log_set_open_when_needed()
Otherwise, several error logs may not be shown.
This commit is contained in:
parent
a601e702d5
commit
a723521fd2
@ -77,6 +77,8 @@ static int open_sockets(int *epoll_fd, bool accept) {
|
|||||||
except[i] = SD_LISTEN_FDS_START + i;
|
except[i] = SD_LISTEN_FDS_START + i;
|
||||||
|
|
||||||
log_close();
|
log_close();
|
||||||
|
log_set_open_when_needed(true);
|
||||||
|
|
||||||
r = close_all_fds(except, n);
|
r = close_all_fds(except, n);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to close all file descriptors: %m");
|
return log_error_errno(r, "Failed to close all file descriptors: %m");
|
||||||
@ -87,17 +89,17 @@ static int open_sockets(int *epoll_fd, bool accept) {
|
|||||||
|
|
||||||
STRV_FOREACH(address, arg_listen) {
|
STRV_FOREACH(address, arg_listen) {
|
||||||
r = make_socket_fd(LOG_DEBUG, *address, arg_socket_type, (arg_accept * SOCK_CLOEXEC));
|
r = make_socket_fd(LOG_DEBUG, *address, arg_socket_type, (arg_accept * SOCK_CLOEXEC));
|
||||||
if (r < 0) {
|
if (r < 0)
|
||||||
log_open();
|
|
||||||
return log_error_errno(r, "Failed to open '%s': %m", *address);
|
return log_error_errno(r, "Failed to open '%s': %m", *address);
|
||||||
}
|
|
||||||
|
|
||||||
assert(r == SD_LISTEN_FDS_START + count);
|
assert(r == SD_LISTEN_FDS_START + count);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_listen)
|
if (arg_listen) {
|
||||||
log_open();
|
log_open();
|
||||||
|
log_set_open_when_needed(false);
|
||||||
|
}
|
||||||
|
|
||||||
*epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
*epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|
||||||
if (*epoll_fd < 0)
|
if (*epoll_fd < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user