mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-24 21:34:08 +03:00
homed,userdb: don't use sockaddr_un_set_path() on fixed addresses
Let's use structured initialization and let the compiler do its job.
This commit is contained in:
parent
f36a9d5909
commit
425d925f24
@ -1056,7 +1056,10 @@ static int on_notify_socket(sd_event_source *s, int fd, uint32_t revents, void *
|
||||
|
||||
static int manager_listen_notify(Manager *m) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
union sockaddr_union sa;
|
||||
union sockaddr_union sa = {
|
||||
.un.sun_family = AF_UNIX,
|
||||
.un.sun_path = "/run/systemd/home/notify",
|
||||
};
|
||||
int r;
|
||||
|
||||
assert(m);
|
||||
@ -1066,10 +1069,6 @@ static int manager_listen_notify(Manager *m) {
|
||||
if (fd < 0)
|
||||
return log_error_errno(errno, "Failed to create listening socket: %m");
|
||||
|
||||
r = sockaddr_un_set_path(&sa.un, "/run/systemd/home/notify");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to set AF_UNIX socket path: %m");
|
||||
|
||||
(void) mkdir_parents(sa.un.sun_path, 0755);
|
||||
(void) sockaddr_un_unlink(&sa.un);
|
||||
|
||||
|
@ -265,11 +265,10 @@ int manager_startup(Manager *m) {
|
||||
if (n == 1)
|
||||
m->listen_fd = SD_LISTEN_FDS_START;
|
||||
else {
|
||||
union sockaddr_union sockaddr;
|
||||
|
||||
r = sockaddr_un_set_path(&sockaddr.un, "/run/systemd/userdb/io.systemd.NameServiceSwitch");
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Cannot assign socket path to socket address: %m");
|
||||
union sockaddr_union sockaddr = {
|
||||
.un.sun_family = AF_UNIX,
|
||||
.un.sun_path = "/run/systemd/userdb/io.systemd.NameServiceSwitch",
|
||||
};
|
||||
|
||||
r = mkdir_p("/run/systemd/userdb", 0755);
|
||||
if (r < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user