summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-12-24 16:42:06 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-24 16:43:33 -0500
commitdb69869f264af2d1afcdd3e573e0e9fdd5bef065 (patch)
tree643d3e9e9afaac54c1a618747a6df547ed912489 /src
parentc4708f132381e4bbc864d5241381b5cde4f54878 (diff)
sleep-config: fix useless check for swapfile type
Since 0c6f1f4ea49 the check was useless, because the kernel will ever only write "partition" or "file" there. OTOH, it is possible that "\\040(deleted)" (escaped " (deleted)") will be added for removed files. This should not happen, so add a warning to detect those cases.
Diffstat (limited to 'src')
-rw-r--r--src/shared/sleep-config.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 2bb0493812..d76e3ad036 100644
--- a/src/shared/sleep-config.c
+++ b/src/shared/sleep-config.c
@@ -183,7 +183,7 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
(void) fscanf(f, "%*s %*s %*s %*s %*s\n");
for (i = 1;; i++) {
- _cleanup_free_ char *dev = NULL, *d = NULL, *type = NULL;
+ _cleanup_free_ char *dev = NULL, *type = NULL;
size_t size_field, used_field;
int k;
@@ -202,12 +202,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
continue;
}
- d = cunescape(dev);
- if (!d)
- return -ENOMEM;
-
- if (!streq(type, "partition") && !streq(type, "file")) {
- log_debug("Partition %s has type %s, ignoring.", d, type);
+ if (streq(type, "partition") && endswith(dev, "\\040(deleted)")) {
+ log_warning("Ignoring deleted swapfile '%s'.", dev);
continue;
}