chiark / gitweb /
treewide: no need to negate errno for log_*_errno()
[elogind.git] / src / tty-ask-password-agent / tty-ask-password-agent.c
index e7cbde285ce89087d011a6b9d336325be76e4e71..12b88fbff0062eb1daa9902dc3bcfa57c0962bf0 100644 (file)
@@ -214,7 +214,7 @@ static int parse_password(const char *filename, char **wall) {
         _cleanup_free_ char *socket_name = NULL, *message = NULL, *packet = NULL;
         uint64_t not_after = 0;
         unsigned pid = 0;
-        bool accept_cached = false;
+        bool accept_cached = false, echo = false;
 
         const ConfigTableItem items[] = {
                 { "Ask", "Socket",       config_parse_string,   0, &socket_name   },
@@ -222,6 +222,7 @@ static int parse_password(const char *filename, char **wall) {
                 { "Ask", "Message",      config_parse_string,   0, &message       },
                 { "Ask", "PID",          config_parse_unsigned, 0, &pid           },
                 { "Ask", "AcceptCached", config_parse_bool,     0, &accept_cached },
+                { "Ask", "Echo",         config_parse_bool,     0, &echo          },
                 {}
         };
 
@@ -314,7 +315,7 @@ static int parse_password(const char *filename, char **wall) {
                                         return tty_fd;
                         }
 
-                        r = ask_password_tty(message, not_after, filename, &password);
+                        r = ask_password_tty(message, not_after, echo, filename, &password);
 
                         if (arg_console) {
                                 safe_close(tty_fd);
@@ -338,7 +339,7 @@ static int parse_password(const char *filename, char **wall) {
                         return 0;
 
                 if (r < 0) {
-                        log_error("Failed to query password: %s", strerror(-r));
+                        log_error_errno(r, "Failed to query password: %m");
                         return r;
                 }
 
@@ -503,7 +504,7 @@ static int watch_passwords(void) {
         for (;;) {
                 r = show_passwords();
                 if (r < 0)
-                        log_error("Failed to show password: %s", strerror(-r));
+                        log_error_errno(r, "Failed to show password: %m");
 
                 if (poll(pollfd, _FD_MAX, -1) < 0) {
                         if (errno == EINTR)
@@ -641,7 +642,7 @@ int main(int argc, char *argv[]) {
                 r = show_passwords();
 
         if (r < 0)
-                log_error("Error: %s", strerror(-r));
+                log_error_errno(r, "Error: %m");
 
 finish:
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;