From: Lennart Poettering Date: Tue, 13 Feb 2018 23:02:23 +0000 (+0100) Subject: ask-password: derive pollfd array from enum X-Git-Tag: v238~100^2~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=088dcd8e41c589f1a180124370a90768a8bd521d;p=thirdparty%2Fsystemd.git ask-password: derive pollfd array from enum It's prettier that way! --- diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index d727f5b142d..8664513a89a 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -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);