summaryrefslogtreecommitdiff
path: root/src/core/swap.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-17 15:12:16 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-09-17 16:44:38 -0400
commit9fb3675e7ef0c6b7a1780980e51492c44fd1faaf (patch)
treec8ce724cb92108a6963e0e9a5428ac2214a7b417 /src/core/swap.c
parent22f5f6281fc25f43a85938e9dad2480b2595c471 (diff)
Use first partition in /proc/swaps for hibernation test
It seems that the kernel uses the first configured partition for hibernation. If it is too full, hibernation will fail. Test that directly.
Diffstat (limited to 'src/core/swap.c')
-rw-r--r--src/core/swap.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/core/swap.c b/src/core/swap.c
index 76c7d45006..82bfad187e 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -1074,7 +1074,7 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
(void) fscanf(m->proc_swaps, "%*s %*s %*s %*s %*s\n");
for (i = 1;; i++) {
- char *dev = NULL, *d;
+ _cleanup_free_ char *dev = NULL, *d = NULL;
int prio = 0, k;
k = fscanf(m->proc_swaps,
@@ -1089,19 +1089,14 @@ static int swap_load_proc_swaps(Manager *m, bool set_flags) {
break;
log_warning("Failed to parse /proc/swaps:%u", i);
- free(dev);
continue;
}
d = cunescape(dev);
- free(dev);
-
if (!d)
return -ENOMEM;
k = swap_process_new_swap(m, d, prio, set_flags);
- free(d);
-
if (k < 0)
r = k;
}