X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftty-ask-password-agent%2Ftty-ask-password-agent.c;h=55a2215d0a2517253a86265e62f50e551f92fa4a;hb=d77ab3f7e3e56a4fd370caff6347bf4e56e51dec;hp=7a90e6507fb1b59b9f18e2232af39c601b81abb8;hpb=39883f622f392d8579f4428fc5a789a102efbb10;p=elogind.git diff --git a/src/tty-ask-password-agent/tty-ask-password-agent.c b/src/tty-ask-password-agent/tty-ask-password-agent.c index 7a90e6507..55a2215d0 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -234,11 +234,8 @@ static int ask_password_plymouth( r = 0; finish: - if (notify >= 0) - close_nointr_nofail(notify); - - if (fd >= 0) - close_nointr_nofail(fd); + safe_close(notify); + safe_close(fd); free(packet); @@ -372,7 +369,7 @@ static int parse_password(const char *filename, char **wall) { r = ask_password_tty(message, not_after, filename, &password); if (arg_console) { - close_nointr_nofail(tty_fd); + safe_close(tty_fd); release_terminal(); } @@ -419,8 +416,7 @@ static int parse_password(const char *filename, char **wall) { finish: fclose(f); - if (socket_fd >= 0) - close_nointr_nofail(socket_fd); + safe_close(socket_fd); free(packet); free(socket_name); @@ -436,7 +432,7 @@ static int wall_tty_block(void) { r = get_ctty_devnr(0, &devnr); if (r < 0) - return -r; + return r; if (asprintf(&p, "/run/systemd/ask-password-block/%u:%u", major(devnr), minor(devnr)) < 0) return -ENOMEM; @@ -492,7 +488,7 @@ static bool wall_tty_match(const char *path) { return true; /* What, we managed to open the pipe? Then this tty is filtered. */ - close_nointr_nofail(fd); + safe_close(fd); return false; } @@ -505,7 +501,7 @@ static int show_passwords(void) { if (errno == ENOENT) return 0; - log_error("opendir(): %m"); + log_error("opendir(/run/systemd/ask-password): %m"); return -errno; } @@ -538,7 +534,7 @@ static int show_passwords(void) { free(p); if (wall) { - utmp_wall(wall, wall_tty_match); + utmp_wall(wall, NULL, wall_tty_match); free(wall); } } @@ -614,14 +610,9 @@ static int watch_passwords(void) { r = 0; finish: - if (notify >= 0) - close_nointr_nofail(notify); - - if (signal_fd >= 0) - close_nointr_nofail(signal_fd); - - if (tty_block_fd >= 0) - close_nointr_nofail(tty_block_fd); + safe_close(notify); + safe_close(signal_fd); + safe_close(tty_block_fd); return r; }