1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-25 06:03:40 +03:00

sleep-config: add more debug logging

This commit is contained in:
Lennart Poettering 2020-06-10 16:40:36 +02:00
parent 0f2d351f79
commit c0d8fbfa34

View File

@ -108,12 +108,16 @@ int can_sleep_state(char **types) {
return true; return true;
/* If /sys is read-only we cannot sleep */ /* If /sys is read-only we cannot sleep */
if (access("/sys/power/state", W_OK) < 0) if (access("/sys/power/state", W_OK) < 0) {
log_debug_errno(errno, "/sys/power/state is not writable, cannot sleep: %m");
return false; return false;
}
r = read_one_line_file("/sys/power/state", &p); r = read_one_line_file("/sys/power/state", &p);
if (r < 0) if (r < 0) {
log_debug_errno(r, "Failed to read /sys/power/state, cannot sleep: %m");
return false; return false;
}
STRV_FOREACH(type, types) { STRV_FOREACH(type, types) {
const char *word, *state; const char *word, *state;