X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fask-password.c;h=9e4d9e7e686be77fcd0fc0b87cbb15586781f637;hp=7247c7eda6df84cc00a76d7507f5fc54e3c5a122;hb=52661efd21608dc7e0ac26b714a9254ed6180ddb;hpb=1b39d4b9d271f2309a193d4e4fae6633248b0e94 diff --git a/src/ask-password.c b/src/ask-password.c index 7247c7eda..9e4d9e7e6 100644 --- a/src/ask-password.c +++ b/src/ask-password.c @@ -33,6 +33,7 @@ #include #include #include +#include #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; @@ -93,7 +94,7 @@ fail: static int help(void) { printf("%s [OPTIONS...] MESSAGE\n\n" - "Query the user for a passphrase.\n\n" + "Query the user for a system passphrase, via the TTY or an UI agent.\n\n" " -h --help Show this help\n" " --icon=NAME Icon name\n" " --timeout=USEC Timeout in usec\n" @@ -171,7 +172,7 @@ static int ask_agent(void) { int fd = -1, r; FILE *f = NULL; char *socket_name = NULL; - int socket_fd, signal_fd; + int socket_fd = -1, signal_fd; sigset_t mask; usec_t not_after;