From: Lennart Poettering Date: Wed, 24 Oct 2018 10:57:37 +0000 (+0200) Subject: sleep: no need to check for resume_offset twice X-Git-Tag: v240~475^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c695101f47824a6d2142621b439a69f4373f2abf;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/sleep/sleep.c b/src/sleep/sleep.c index 771a8cd48bd..eeaf8d8972d 100644 --- a/src/sleep/sleep.c +++ b/src/sleep/sleep.c @@ -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)