chiark / gitweb /
terminal: fix wrong return value in idev if fcntl() fails
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 11 Sep 2014 13:29:58 +0000 (15:29 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 11 Sep 2014 13:29:58 +0000 (15:29 +0200)
This might cause >=0 to be returned, even though the method failed. Fix
this and return -errno.

src/libsystemd-terminal/idev-evdev.c

index be9b0301a4c81156a3476f541806e52c5e2e1a7f..241743c3fdc7fafb0c9c5b2eabbd2acd88cabb16 100644 (file)
@@ -307,7 +307,7 @@ static int idev_evdev_resume(idev_evdev *evdev, int dev_fd) {
 
         flags = fcntl(fd, F_GETFL, 0);
         if (flags < 0)
 
         flags = fcntl(fd, F_GETFL, 0);
         if (flags < 0)
-                return r;
+                return -errno;
 
         flags &= O_ACCMODE;
         if (flags == O_WRONLY)
 
         flags &= O_ACCMODE;
         if (flags == O_WRONLY)