chiark / gitweb /
time-util: add and use USEC/NSEC_INFINIY
[elogind.git] / src / tty-ask-password-agent / tty-ask-password-agent.c
index a7fce518a52a77fd71c457de97c2bb1a64d82710..94ae5670f7d25ed92c8880a740e0e5ba73866d6b 100644 (file)
@@ -102,8 +102,9 @@ static int ask_password_plymouth(
         if (accept_cached) {
                 packet = strdup("c");
                 n = 1;
-        } else
-                asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1), message, &n);
+        } else if (asprintf(&packet, "*\002%c%s%n", (int) (strlen(message) + 1),
+                            message, &n) < 0)
+                packet = NULL;
 
         if (!packet) {
                 r = -ENOMEM;
@@ -342,7 +343,7 @@ static int parse_password(const char *filename, char **wall) {
                         _cleanup_free_ char *password = NULL;
 
                         if (arg_console) {
-                                tty_fd = acquire_terminal("/dev/console", false, false, false, (usec_t) -1);
+                                tty_fd = acquire_terminal("/dev/console", false, false, false, USEC_INFINITY);
                                 if (tty_fd < 0)
                                         return tty_fd;
                         }