X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fshared%2Fask-password-api.c;h=c9c82b25206d9444778e6432be5ec071b08758be;hb=127b55d5a49e8e534e12107fc5d5a684c390d7aa;hp=277efd302ef60e3478f5a25c54e8fd9d98189ddc;hpb=5c0d398dfc4d79df2209515d28cafd9dc129838e;p=elogind.git diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 277efd302..c9c82b252 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -109,7 +109,6 @@ int ask_password_tty( } zero(pollfd); - pollfd[POLL_TTY].fd = ttyfd >= 0 ? ttyfd : STDIN_FILENO; pollfd[POLL_TTY].events = POLLIN; pollfd[POLL_INOTIFY].fd = notify; @@ -248,8 +247,11 @@ static int create_socket(char **name) { union { struct sockaddr sa; struct sockaddr_un un; - } sa; - int one = 1, r; + } sa = { + .un.sun_family = AF_UNIX, + }; + int one = 1; + int r = 0; char *c; assert(name); @@ -260,9 +262,7 @@ static int create_socket(char **name) { return -errno; } - zero(sa); - sa.un.sun_family = AF_UNIX; - snprintf(sa.un.sun_path, sizeof(sa.un.sun_path)-1, "/run/systemd/ask-password/sck.%llu", random_ull()); + snprintf(sa.un.sun_path, sizeof(sa.un.sun_path)-1, "/run/systemd/ask-password/sck.%" PRIx64, random_u64()); RUN_WITH_UMASK(0177) { r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));