summaryrefslogtreecommitdiffstats
path: root/src/shared/hibernate-util.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-25 02:54:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-25 02:54:53 +0000
commit527e791c5346846e2bc7d32f7597d70f9a274499 (patch)
treed2bd96487387b049f0a99182d4cfd066adddd039 /src/shared/hibernate-util.c
parentAdding debian version 255.4-1. (diff)
downloadsystemd-527e791c5346846e2bc7d32f7597d70f9a274499.tar.xz
systemd-527e791c5346846e2bc7d32f7597d70f9a274499.zip
Merging upstream version 255.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/shared/hibernate-util.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/shared/hibernate-util.c b/src/shared/hibernate-util.c
index 0d215e8..c3991cf 100644
--- a/src/shared/hibernate-util.c
+++ b/src/shared/hibernate-util.c
@@ -23,6 +23,7 @@
#include "log.h"
#include "parse-util.h"
#include "path-util.h"
+#include "proc-cmdline.h"
#include "stat-util.h"
#include "string-util.h"
#include "strv.h"
@@ -129,6 +130,13 @@ static int read_resume_config(dev_t *ret_devno, uint64_t *ret_offset) {
assert(ret_devno);
assert(ret_offset);
+ r = proc_cmdline_get_key("noresume", /* flags = */ 0, /* ret_value = */ NULL);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to check if 'noresume' kernel command line option is set: %m");
+ if (r > 0)
+ return log_debug_errno(SYNTHETIC_ERRNO(ENOTRECOVERABLE),
+ "'noresume' kernel command line option is set, refusing hibernation device lookup.");
+
r = read_one_line_file("/sys/power/resume", &devno_str);
if (r < 0)
return log_debug_errno(r, "Failed to read /sys/power/resume: %m");