From: Lennart Poettering Date: Mon, 26 Feb 2018 17:32:07 +0000 (+0100) Subject: logind: rework sd_eviocrevoke() X-Git-Tag: v238~51^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d5330a8e4c6f5926d74f1e0f4bfad2e6355235a;p=thirdparty%2Fsystemd.git logind: rework sd_eviocrevoke() Let's initialize static variables properly and get rid of redundant variables. --- diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c index b1bac04036a..0992f26d653 100644 --- a/src/login/logind-session-device.c +++ b/src/login/logind-session-device.c @@ -107,17 +107,15 @@ static int session_device_notify(SessionDevice *sd, enum SessionDeviceNotificati } static int sd_eviocrevoke(int fd) { - static bool warned; - int r; + static bool warned = false; assert(fd >= 0); - r = ioctl(fd, EVIOCREVOKE, NULL); - if (r < 0) { - r = -errno; - if (r == -EINVAL && !warned) { + if (ioctl(fd, EVIOCREVOKE, NULL) < 0) { + + if (errno == EINVAL && !warned) { + log_warning_errno(errno, "Kernel does not support evdev-revocation: %m"); warned = true; - log_warning("kernel does not support evdev-revocation"); } }