mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-12 09:17:44 +03:00
Merge pull request #11361 from yuwata/follow-up-11352
core/socket: two follow-ups for #11352
This commit is contained in:
commit
8f44e0f419
@ -1465,16 +1465,13 @@ static int socket_address_listen_do(
|
||||
label);
|
||||
}
|
||||
|
||||
static int log_address_error_errno(Unit *u, const SocketAddress *address, int error, const char *fmt) {
|
||||
_cleanup_free_ char *t = NULL;
|
||||
|
||||
(void) socket_address_print(address, &t);
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
return log_unit_error_errno(u, error, fmt, strna(t));
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
#define log_address_error_errno(u, address, error, fmt) \
|
||||
({ \
|
||||
_cleanup_free_ char *_t = NULL; \
|
||||
\
|
||||
(void) socket_address_print(address, &_t); \
|
||||
log_unit_error_errno(u, error, fmt, strna(_t)); \
|
||||
})
|
||||
|
||||
static int socket_address_listen_in_cgroup(
|
||||
Socket *s,
|
||||
@ -1596,49 +1593,43 @@ static int socket_open_fds(Socket *_s) {
|
||||
break;
|
||||
}
|
||||
|
||||
r = socket_address_listen_in_cgroup(s, &p->address, label);
|
||||
if (r < 0)
|
||||
return r;
|
||||
p->fd = socket_address_listen_in_cgroup(s, &p->address, label);
|
||||
if (p->fd < 0)
|
||||
return p->fd;
|
||||
|
||||
p->fd = r;
|
||||
socket_apply_socket_options(s, p->fd);
|
||||
socket_symlink(s);
|
||||
break;
|
||||
|
||||
case SOCKET_SPECIAL:
|
||||
|
||||
r = special_address_create(p->path, s->writable);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to open special file %s: %m", p->path);
|
||||
|
||||
p->fd = r;
|
||||
p->fd = special_address_create(p->path, s->writable);
|
||||
if (p->fd < 0)
|
||||
return log_unit_error_errno(UNIT(s), p->fd, "Failed to open special file %s: %m", p->path);
|
||||
break;
|
||||
|
||||
case SOCKET_FIFO:
|
||||
|
||||
r = fifo_address_create(
|
||||
p->fd = fifo_address_create(
|
||||
p->path,
|
||||
s->directory_mode,
|
||||
s->socket_mode);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to open FIFO %s: %m", p->path);
|
||||
if (p->fd < 0)
|
||||
return log_unit_error_errno(UNIT(s), p->fd, "Failed to open FIFO %s: %m", p->path);
|
||||
|
||||
p->fd = r;
|
||||
socket_apply_fifo_options(s, p->fd);
|
||||
socket_symlink(s);
|
||||
break;
|
||||
|
||||
case SOCKET_MQUEUE:
|
||||
|
||||
r = mq_address_create(
|
||||
p->fd = mq_address_create(
|
||||
p->path,
|
||||
s->socket_mode,
|
||||
s->mq_maxmsg,
|
||||
s->mq_msgsize);
|
||||
if (r < 0)
|
||||
return log_unit_error_errno(UNIT(s), r, "Failed to open message queue %s: %m", p->path);
|
||||
|
||||
p->fd = r;
|
||||
if (p->fd < 0)
|
||||
return log_unit_error_errno(UNIT(s), p->fd, "Failed to open message queue %s: %m", p->path);
|
||||
break;
|
||||
|
||||
case SOCKET_USB_FUNCTION: {
|
||||
@ -1646,11 +1637,9 @@ static int socket_open_fds(Socket *_s) {
|
||||
|
||||
ep = path_make_absolute("ep0", p->path);
|
||||
|
||||
r = usbffs_address_create(ep);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
p->fd = r;
|
||||
p->fd = usbffs_address_create(ep);
|
||||
if (p->fd < 0)
|
||||
return p->fd;
|
||||
|
||||
r = usbffs_write_descs(p->fd, SERVICE(UNIT_DEREF(s->service)));
|
||||
if (r < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user