]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
ask-password: derive pollfd array from enum
authorLennart Poettering <lennart@poettering.net>
Tue, 13 Feb 2018 23:02:23 +0000 (00:02 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 13 Feb 2018 23:03:05 +0000 (00:03 +0100)
It's prettier that way!

src/shared/ask-password-api.c

index d727f5b142d24caef923433606e035751ff2c65b..8664513a89a53eee3a2849faabf3a94a91cd740c 100644 (file)
@@ -209,18 +209,20 @@ int ask_password_tty(
                 const char *flag_file,
                 char **ret) {
 
+        enum {
+                POLL_TTY,
+                POLL_INOTIFY,
+                _POLL_MAX,
+        };
+
+        _cleanup_close_ int ttyfd = -1, notify = -1;
         struct termios old_termios, new_termios;
         char passphrase[LINE_MAX + 1] = {}, *x;
+        struct pollfd pollfd[_POLL_MAX];
         size_t p = 0, codepoint = 0;
-        int r;
-        _cleanup_close_ int ttyfd = -1, notify = -1;
-        struct pollfd pollfd[2];
         bool reset_tty = false;
         bool dirty = false;
-        enum {
-                POLL_TTY,
-                POLL_INOTIFY
-        };
+        int r;
 
         assert(ret);