diff options
author | Evgeny Vereshchagin <evvers@ya.ru> | 2016-05-07 19:17:44 +0300 |
---|---|---|
committer | Evgeny Vereshchagin <evvers@ya.ru> | 2016-05-07 19:17:44 +0300 |
commit | 5ab42bc85a11a5250dcdf8e86291d3da90aa84bd (patch) | |
tree | 1493f86c5031484546ab98d242303101d3b43017 /src/journal/journald-native.c | |
parent | d2cc96a8e134e8166acb917f67b3e8b308e09370 (diff) | |
parent | 23be5709e10b3b88a9908f3005351ccba9e5d48b (diff) |
Merge pull request #3191 from poettering/cgroups-agent-dgram
core: use an AF_UNIX/SOCK_DGRAM socket for cgroup agent notification
Diffstat (limited to 'src/journal/journald-native.c')
-rw-r--r-- | src/journal/journald-native.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index a445291a5e..0a1ce205c2 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -448,24 +448,24 @@ void server_process_native_file( } int server_open_native_socket(Server*s) { + + static const union sockaddr_union sa = { + .un.sun_family = AF_UNIX, + .un.sun_path = "/run/systemd/journal/socket", + }; static const int one = 1; int r; assert(s); if (s->native_fd < 0) { - union sockaddr_union sa = { - .un.sun_family = AF_UNIX, - .un.sun_path = "/run/systemd/journal/socket", - }; - s->native_fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0); if (s->native_fd < 0) return log_error_errno(errno, "socket() failed: %m"); - unlink(sa.un.sun_path); + (void) unlink(sa.un.sun_path); - r = bind(s->native_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path)); + r = bind(s->native_fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)); if (r < 0) return log_error_errno(errno, "bind(%s) failed: %m", sa.un.sun_path); |