aboutsummaryrefslogtreecommitdiff
path: root/backend/session
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-04-15 20:26:23 +0200
committerSimon Ser <contact@emersion.fr>2020-04-15 21:36:19 +0200
commit904c37845dec60fc5ee91d11b5e6c75656651b33 (patch)
tree5fad8f632eac55559501c9dd34f7ca03eb716f9e /backend/session
parentffcf25cc2593c1b7acb93c85d4782c0fe4cc7082 (diff)
logind: Close fd before releasing device
This speeds up shutdown significantly, and is in line with how Weston does it.
Diffstat (limited to 'backend/session')
-rw-r--r--backend/session/logind.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/backend/session/logind.c b/backend/session/logind.c
index 9b7b9650..b5acd4e4 100644
--- a/backend/session/logind.c
+++ b/backend/session/logind.c
@@ -107,8 +107,10 @@ static void logind_release_device(struct wlr_session *base, int fd) {
if (fstat(fd, &st) < 0) {
wlr_log(WLR_ERROR, "Failed to stat device '%d': %s", fd,
strerror(errno));
+ close(fd);
return;
}
+ close(fd);
sd_bus_message *msg = NULL;
sd_bus_error error = SD_BUS_ERROR_NULL;
@@ -122,7 +124,6 @@ static void logind_release_device(struct wlr_session *base, int fd) {
sd_bus_error_free(&error);
sd_bus_message_unref(msg);
- close(fd);
}
static bool logind_change_vt(struct wlr_session *base, unsigned vt) {