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=276ccf9780e3b7558a1282cf97f7acfae1cf83f8;hb=2826d14091e43ed3397d862dee79d09d0115c84e;hp=0dec0629c0012daa327549ad4b7192bfc707b9bd;hpb=af6da548aa14c57da7f17b3a1f2211efdb811d19;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 0dec0629c..276ccf978 100644 --- a/src/tty-ask-password-agent/tty-ask-password-agent.c +++ b/src/tty-ask-password-agent/tty-ask-password-agent.c @@ -40,6 +40,7 @@ #include "socket-util.h" #include "ask-password-api.h" #include "strv.h" +#include "build.h" static enum { ACTION_LIST, @@ -80,6 +81,7 @@ static int ask_password_plymouth( } if (inotify_add_watch(notify, flag_file, IN_ATTRIB /* for the link count */) < 0) { + log_error("Failed to add watch on %s: %m", flag_file); r = -errno; goto finish; } @@ -314,8 +316,7 @@ static int parse_password(const char *filename, char **wall) { *wall ? "\r\n\r\n" : "", message, pid) < 0) { - log_error("Out of memory"); - r = -ENOMEM; + r = log_oom(); goto finish; } @@ -532,8 +533,7 @@ static int show_passwords(void) { continue; if (!(p = strappend("/run/systemd/ask-password/", de->d_name))) { - log_error("Out of memory"); - r = -ENOMEM; + r = log_oom(); goto finish; } @@ -578,6 +578,7 @@ static int watch_passwords(void) { } if (inotify_add_watch(notify, "/run/systemd/ask-password", IN_CLOSE_WRITE|IN_MOVED_TO) < 0) { + log_error("Failed to add watch on /run/systemd/ask-password: %m"); r = -errno; goto finish; } @@ -638,6 +639,7 @@ static int help(void) { printf("%s [OPTIONS...]\n\n" "Process system password requests.\n\n" " -h --help Show this help\n" + " --version Show package version\n" " --list Show pending password requests\n" " --query Process pending password requests\n" " --watch Continuously process password requests\n" @@ -657,11 +659,13 @@ static int parse_argv(int argc, char *argv[]) { ARG_WATCH, ARG_WALL, ARG_PLYMOUTH, - ARG_CONSOLE + ARG_CONSOLE, + ARG_VERSION }; static const struct option options[] = { { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, ARG_VERSION }, { "list", no_argument, NULL, ARG_LIST }, { "query", no_argument, NULL, ARG_QUERY }, { "watch", no_argument, NULL, ARG_WATCH }, @@ -684,6 +688,11 @@ static int parse_argv(int argc, char *argv[]) { help(); return 0; + case ARG_VERSION: + puts(PACKAGE_STRING); + puts(SYSTEMD_FEATURES); + return 0; + case ARG_LIST: arg_action = ACTION_LIST; break; @@ -728,6 +737,7 @@ static int parse_argv(int argc, char *argv[]) { int main(int argc, char *argv[]) { int r; + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open();