summaryrefslogtreecommitdiff
path: root/src/ask-password.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-10-07 02:34:17 +0200
committerLennart Poettering <lennart@poettering.net>2010-10-07 02:34:17 +0200
commit0e098b15c76e222f7de381203c0c35a75a5b2f24 (patch)
tree864b2b06696c7fcc4d0c29daa3121574c52f004b /src/ask-password.c
parente983b76024342278a0377eae116c925f2567776e (diff)
util: never use sizeof(sa_family_t) when calculating sockaddr sizes
Diffstat (limited to 'src/ask-password.c')
-rw-r--r--src/ask-password.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ask-password.c b/src/ask-password.c
index bcee6863c9..9e4d9e7e68 100644
--- a/src/ask-password.c
+++ b/src/ask-password.c
@@ -33,6 +33,7 @@
#include <getopt.h>
#include <termios.h>
#include <limits.h>
+#include <stddef.h>
#include "log.h"
#include "macro.h"
@@ -63,7 +64,7 @@ static int create_socket(char **name) {
sa.un.sun_family = AF_UNIX;
snprintf(sa.un.sun_path+1, sizeof(sa.un.sun_path)-1, "/org/freedesktop/systemd1/ask-password/%llu", random_ull());
- if (bind(fd, &sa.sa, sizeof(sa_family_t) + 1 + strlen(sa.un.sun_path+1)) < 0) {
+ if (bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
r = -errno;
log_error("bind() failed: %m");
goto fail;