X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Ftty-ask-password-agent%2Ftty-ask-password-agent.c;h=fa4d660215e72ec6eec70912e3c307fd910a05b1;hb=9003d9b0d628be059922e522fd35f9c5b4d8b039;hp=1f55e3229ba350b2870b7f20180c03e10ca3f0be;hpb=cb90460e04743dd66dea37534af601786c428206;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 1f55e3229..fa4d66021 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -275,7 +275,7 @@ static int parse_password(const char *filename, char **wall) { return -errno; } - r = config_parse(filename, f, NULL, config_item_table_lookup, (void*) items, true, NULL); + r = config_parse(NULL, filename, f, NULL, config_item_table_lookup, (void*) items, true, false, NULL); if (r < 0) { log_error("Failed to parse password file %s: %s", filename, strerror(-r)); goto finish; @@ -294,9 +294,7 @@ static int parse_password(const char *filename, char **wall) { } } - if (pid > 0 && - kill(pid, 0) < 0 && - errno == ESRCH) { + if (pid > 0 && !pid_is_alive(pid)) { r = 0; goto finish; } @@ -363,7 +361,7 @@ static int parse_password(const char *filename, char **wall) { } else { int tty_fd = -1; - char *password; + char *password = NULL; if (arg_console) if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) { @@ -540,7 +538,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); } } @@ -666,7 +664,7 @@ static int parse_argv(int argc, char *argv[]) { { "wall", no_argument, NULL, ARG_WALL }, { "plymouth", no_argument, NULL, ARG_PLYMOUTH }, { "console", no_argument, NULL, ARG_CONSOLE }, - { NULL, 0, NULL, 0 } + {} }; int c; @@ -679,8 +677,7 @@ static int parse_argv(int argc, char *argv[]) { switch (c) { case 'h': - help(); - return 0; + return help(); case ARG_VERSION: puts(PACKAGE_STRING); @@ -715,8 +712,7 @@ static int parse_argv(int argc, char *argv[]) { return -EINVAL; default: - log_error("Unknown option code %c", c); - return -EINVAL; + assert_not_reached("Unhandled option"); } }