mirror of
https://github.com/swaywm/sway.git
synced 2026-04-28 06:46:26 -04:00
swayidle: fix log message about lock fd
This commit is contained in:
parent
011dba73c3
commit
cab5449b1d
1 changed files with 5 additions and 9 deletions
|
|
@ -87,29 +87,25 @@ static void acquire_sleep_lock(void) {
|
||||||
"Setup Up Lock Screen", "delay");
|
"Setup Up Lock Screen", "delay");
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(WLR_ERROR, "Failed to send Inhibit signal: %s", error.message);
|
wlr_log(WLR_ERROR, "Failed to send Inhibit signal: %s", error.message);
|
||||||
sd_bus_error_free(&error);
|
goto cleanup;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sd_bus_message_read(msg, "h", &lock_fd);
|
ret = sd_bus_message_read(msg, "h", &lock_fd);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
wlr_log(WLR_ERROR, "Failed to parse D-Bus response for Inhibit: %s",
|
wlr_log(WLR_ERROR, "Failed to parse D-Bus response for Inhibit: %s",
|
||||||
strerror(-ret));
|
strerror(-ret));
|
||||||
sd_bus_error_free(&error);
|
goto cleanup;
|
||||||
sd_bus_message_unref(msg);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
wlr_log(WLR_INFO, "Got sleep lock: %d", lock_fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// sd_bus_message_unref closes the file descriptor so we need
|
// sd_bus_message_unref closes the file descriptor so we need
|
||||||
// to copy it beforehand
|
// to copy it beforehand
|
||||||
lock_fd = fcntl(lock_fd, F_DUPFD_CLOEXEC, 3);
|
lock_fd = fcntl(lock_fd, F_DUPFD_CLOEXEC, 3);
|
||||||
if (lock_fd < 0) {
|
if (lock_fd < 0) {
|
||||||
wlr_log(WLR_ERROR, "Failed to copy sleep lock fd: %s",
|
wlr_log(WLR_ERROR, "Failed to copy sleep lock fd: %s", strerror(errno));
|
||||||
strerror(errno));
|
|
||||||
}
|
}
|
||||||
|
wlr_log(WLR_INFO, "Got sleep lock: %d", lock_fd);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
sd_bus_error_free(&error);
|
sd_bus_error_free(&error);
|
||||||
sd_bus_message_unref(msg);
|
sd_bus_message_unref(msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue