chiark / gitweb /
logind: rework sd_eviocrevoke()
authorLennart Poettering <lennart@poettering.net>
Mon, 26 Feb 2018 17:32:07 +0000 (18:32 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 30 May 2018 05:59:06 +0000 (07:59 +0200)
Let's initialize static variables properly and get rid of redundant
variables.

src/login/logind-session-device.c

index cc56e62df0446c46a5e9a0f983b4775ce35243fc..b74f31a3743bbe8284b168c409b3ae7c3ada92b0 100644 (file)
@@ -111,17 +111,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");
                 }
         }