summaryrefslogtreecommitdiff
path: root/src/reply-password/reply-password.c
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2016-05-07 19:17:44 +0300
committerEvgeny Vereshchagin <evvers@ya.ru>2016-05-07 19:17:44 +0300
commit5ab42bc85a11a5250dcdf8e86291d3da90aa84bd (patch)
tree1493f86c5031484546ab98d242303101d3b43017 /src/reply-password/reply-password.c
parentd2cc96a8e134e8166acb917f67b3e8b308e09370 (diff)
parent23be5709e10b3b88a9908f3005351ccba9e5d48b (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/reply-password/reply-password.c')
-rw-r--r--src/reply-password/reply-password.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/reply-password/reply-password.c b/src/reply-password/reply-password.c
index e291758969..17eab9772e 100644
--- a/src/reply-password/reply-password.c
+++ b/src/reply-password/reply-password.c
@@ -26,14 +26,12 @@
#include "fd-util.h"
#include "log.h"
#include "macro.h"
+#include "socket-util.h"
#include "string-util.h"
#include "util.h"
static int send_on_socket(int fd, const char *socket_name, const void *packet, size_t size) {
- union {
- struct sockaddr sa;
- struct sockaddr_un un;
- } sa = {
+ union sockaddr_union sa = {
.un.sun_family = AF_UNIX,
};
@@ -43,7 +41,7 @@ static int send_on_socket(int fd, const char *socket_name, const void *packet, s
strncpy(sa.un.sun_path, socket_name, sizeof(sa.un.sun_path));
- if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(socket_name)) < 0)
+ if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0)
return log_error_errno(errno, "Failed to send: %m");
return 0;