|
Zbigniew Jędrzejewski-Szmek |
126222 |
From 5e86ba530ae6f7a4c9aec4069b0b8481003094c6 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
From: Dave Reisner <dreisner@archlinux.org>
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
Date: Tue, 24 Dec 2013 16:42:06 -0500
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
Subject: [PATCH] sleep-config: fix useless check for swapfile type
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
Since 0c6f1f4ea49 the check was useless, because the kernel will
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
ever only write "partition" or "file" there.
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
OTOH, it is possible that "\\040(deleted)" (escaped " (deleted)")
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
will be added for removed files. This should not happen, so add
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
a warning to detect those cases.
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
src/shared/sleep-config.c | 10 +++-------
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
1 file changed, 3 insertions(+), 7 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
index 2bb0493..d76e3ad 100644
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
--- a/src/shared/sleep-config.c
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
+++ b/src/shared/sleep-config.c
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
@@ -183,7 +183,7 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
(void) fscanf(f, "%*s %*s %*s %*s %*s\n");
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
for (i = 1;; i++) {
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
- _cleanup_free_ char *dev = NULL, *d = NULL, *type = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
+ _cleanup_free_ char *dev = NULL, *type = NULL;
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
size_t size_field, used_field;
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
int k;
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
@@ -202,12 +202,8 @@ static int hibernation_partition_size(size_t *size, size_t *used) {
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
continue;
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
- d = cunescape(dev);
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
- if (!d)
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
- return -ENOMEM;
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
- if (!streq(type, "partition") && !streq(type, "file")) {
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
- log_debug("Partition %s has type %s, ignoring.", d, type);
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
+ if (streq(type, "partition") && endswith(dev, "\\040(deleted)")) {
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
+ log_warning("Ignoring deleted swapfile '%s'.", dev);
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
continue;
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
}
|
|
Zbigniew Jędrzejewski-Szmek |
126222 |
|