X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Freply-password.c;h=24d73a798e2784a2b4340667bd5fbc599b8a482f;hb=00dc5d769ac4a4019d6b6fe22e8383ec8b030a96;hp=236fdcc94cc585d930bdcca757b6035240d20a15;hpb=490aed584944b684026a3fd01f8d81f2881e38d6;p=elogind.git diff --git a/src/reply-password.c b/src/reply-password.c index 236fdcc94..24d73a798 100644 --- a/src/reply-password.c +++ b/src/reply-password.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "log.h" #include "macro.h" @@ -50,7 +51,7 @@ static int send_on_socket(int fd, const char *socket_name, const void *packet, s sa.un.sun_family = AF_UNIX; strncpy(sa.un.sun_path+1, socket_name, sizeof(sa.un.sun_path)-1); - if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, sizeof(sa_family_t) + 1 + strlen(socket_name)) < 0) { + if (sendto(fd, packet, size, MSG_NOSIGNAL, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(socket_name)) < 0) { log_error("Failed to send: %m"); return -1; }