summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-07-25 21:41:58 +0200
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:24 +0100
commit37c076d26669a3c39fd6e931da5b66b9edb4ce63 (patch)
tree94ead705bd9f421c0a5438d1095a60e0359464fc
parent88390a9d8b3ad57671c696f7b5b836ed164a84a1 (diff)
sleep-config: partitions can't be deleted, only files can
This fixes something I think was basically a typo introduced in db69869f264af2d1afcdd3e573e0e9fdd5bef065. (cherry picked from commit 3dea6886c20a32d832971e589cbc1807c549b66f)
-rw-r--r--src/shared/sleep-config.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 88f2b7007..347858a12 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -202,27 +202,30 @@ int find_hibernate_location(char **device, char **type, size_t *size, size_t *us
"%zu " /* used */
"%*i\n", /* priority */
&dev_field, &type_field, &size_field, &used_field);
+ if (k == EOF)
+ break;
if (k != 4) {
- if (k == EOF)
- break;
-
log_warning("Failed to parse /proc/swaps:%u", i);
continue;
}
- if (streq(type_field, "partition")) {
+ if (streq(type_field, "file")) {
+
if (endswith(dev_field, "\\040(deleted)")) {
- log_warning("Ignoring deleted swapfile '%s'.", dev_field);
+ log_warning("Ignoring deleted swap file '%s'.", dev_field);
continue;
}
+ } else if (streq(type_field, "partition")) {
const char *fn;
+
fn = path_startswith(dev_field, "/dev/");
if (fn && startswith(fn, "zram")) {
- log_debug("Ignoring compressed ram swap device '%s'.", dev_field);
+ log_debug("Ignoring compressed RAM swap device '%s'.", dev_field);
continue;
}
}
+
if (device)
*device = TAKE_PTR(dev_field);
if (type)