chiark / gitweb /
use "Out of memory." consistantly (or with "\n")
[elogind.git] / src / tty-ask-password-agent / tty-ask-password-agent.c
index 7f537c27408a5692573a756c0a6e24c850859be6..403e8cd3c641a48c67568ecc7d117985e37d48cc 100644 (file)
@@ -40,6 +40,7 @@
 #include "socket-util.h"
 #include "ask-password-api.h"
 #include "strv.h"
+#include "build.h"
 
 static enum {
         ACTION_LIST,
@@ -314,7 +315,7 @@ static int parse_password(const char *filename, char **wall) {
                              *wall ? "\r\n\r\n" : "",
                              message,
                              pid) < 0) {
-                        log_error("Out of memory");
+                        log_error("Out of memory.");
                         r = -ENOMEM;
                         goto finish;
                 }
@@ -368,7 +369,7 @@ static int parse_password(const char *filename, char **wall) {
                         char *password;
 
                         if (arg_console)
-                                if ((tty_fd = acquire_terminal("/dev/console", false, false, false)) < 0) {
+                                if ((tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1)) < 0) {
                                         r = tty_fd;
                                         goto finish;
                                 }
@@ -532,7 +533,7 @@ static int show_passwords(void) {
                         continue;
 
                 if (!(p = strappend("/run/systemd/ask-password/", de->d_name))) {
-                        log_error("Out of memory");
+                        log_error("Out of memory.");
                         r = -ENOMEM;
                         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,12 @@ static int parse_argv(int argc, char *argv[]) {
                         help();
                         return 0;
 
+                case ARG_VERSION:
+                        puts(PACKAGE_STRING);
+                        puts(DISTRIBUTION);
+                        puts(SYSTEMD_FEATURES);
+                        return 0;
+
                 case ARG_LIST:
                         arg_action = ACTION_LIST;
                         break;
@@ -728,6 +738,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();