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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2013-09-17 16:44:38 -04:00
parent 22f5f6281f
commit 9fb3675e7e
2 changed files with 64 additions and 23 deletions
+1 -6
View File
@@ -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;
}