diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-07-25 21:41:58 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2018-07-26 11:01:29 +0200 |
commit | 3dea6886c20a32d832971e589cbc1807c549b66f (patch) | |
tree | 473562f390894eec6952669a5fd0303028399c8a /src/shared/sleep-config.c | |
parent | Merge pull request #9684 from yuwata/fix-9672 (diff) | |
download | systemd-3dea6886c20a32d832971e589cbc1807c549b66f.tar.xz systemd-3dea6886c20a32d832971e589cbc1807c549b66f.zip |
sleep-config: partitions can't be deleted, only files can
This fixes something I think was basically a typo introduced in
db69869f264af2d1afcdd3e573e0e9fdd5bef065.
Diffstat (limited to '')
-rw-r--r-- | src/shared/sleep-config.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index a1523e3f21..ed7c25828e 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -194,27 +194,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) |