sleep: no need to check for resume_offset twice

The W_OK check already checks for existance hence let's remove the F_OK
check.
This commit is contained in:
Lennart Poettering 2018-10-24 12:57:37 +02:00
parent eabcf200f7
commit c695101f47
1 changed files with 5 additions and 6 deletions

View File

@ -54,15 +54,14 @@ static int write_hibernate_location_info(void) {
}
/* Only available in 4.17+ */
if (access("/sys/power/resume_offset", F_OK) < 0) {
if (errno == ENOENT)
if (access("/sys/power/resume_offset", W_OK) < 0) {
if (errno == ENOENT) {
log_debug("Kernel too old, can't configure resume offset, ignoring.");
return 0;
}
return log_debug_errno(errno, "/sys/power/resume_offset unavailable: %m");
}
if (access("/sys/power/resume_offset", W_OK) < 0)
return log_debug_errno(errno, "/sys/power/resume_offset not writeable: %m");
}
fd = open(device, O_RDONLY | O_CLOEXEC | O_NONBLOCK);
if (fd < 0)