summaryrefslogtreecommitdiff
path: root/src/login/logind-button.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-03-07 16:48:14 +0100
committerLennart Poettering <lennart@poettering.net>2013-03-07 16:48:14 +0100
commitc30a0c62fdbf6f11902be9db64ade99fb508adfd (patch)
tree313cc943d2d5fac6ab7997e14bb1166b8f735fec /src/login/logind-button.c
parentdec49d88d6a4febc8be0a4470183d9794b3b02b8 (diff)
logind: don't hit an assert if an close() on an input device fd fails with ENODEV because the device is gone
https://bugzilla.redhat.com/show_bug.cgi?id=907890
Diffstat (limited to 'src/login/logind-button.c')
-rw-r--r--src/login/logind-button.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index cbb067aa55..ea45c28eef 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -71,7 +71,11 @@ void button_free(Button *b) {
if (b->fd >= 0) {
hashmap_remove(b->manager->button_fds, INT_TO_PTR(b->fd + 1));
assert_se(epoll_ctl(b->manager->epoll_fd, EPOLL_CTL_DEL, b->fd, NULL) == 0);
- close_nointr_nofail(b->fd);
+
+ /* If the device has been unplugged close() returns
+ * ENODEV, let's ignore this, hence we don't use
+ * close_nointr_nofail() */
+ close(b->fd);
}
free(b->name);
@@ -103,7 +107,7 @@ int button_open(Button *b) {
assert(b);
if (b->fd >= 0) {
- close_nointr_nofail(b->fd);
+ close(b->fd);
b->fd = -1;
}
@@ -146,7 +150,7 @@ int button_open(Button *b) {
return 0;
fail:
- close_nointr_nofail(b->fd);
+ close(b->fd);
b->fd = -1;
return r;
}