systemd/0221-terminal-fix-wrong-return-value-in-idev-if-fcntl-fai.patch

25 lines
904 B
Diff
Raw Normal View History

2014-10-04 02:43:52 +00:00
From 667b60341f404d8f18aa0909e34d39e7d6baa56b Mon Sep 17 00:00:00 2001
From: David Herrmann <dh.herrmann@gmail.com>
Date: Thu, 11 Sep 2014 15:29:58 +0200
Subject: [PATCH] terminal: fix wrong return value in idev if fcntl() fails
This might cause >=0 to be returned, even though the method failed. Fix
this and return -errno.
---
src/libsystemd-terminal/idev-evdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libsystemd-terminal/idev-evdev.c b/src/libsystemd-terminal/idev-evdev.c
index be9b0301a4..241743c3fd 100644
--- a/src/libsystemd-terminal/idev-evdev.c
+++ b/src/libsystemd-terminal/idev-evdev.c
@@ -307,7 +307,7 @@ static int idev_evdev_resume(idev_evdev *evdev, int dev_fd) {
flags = fcntl(fd, F_GETFL, 0);
if (flags < 0)
- return r;
+ return -errno;
flags &= O_ACCMODE;
if (flags == O_WRONLY)