[systemd-devel] [PATCH] swap: fix swap behaviour with symlinks (2)
Olivier Brunel
i.am.jack.mail at gmail.com
Mon Oct 29 11:15:24 PDT 2012
Make sure swap_add_one is only called once per unit also for symlinks
---
If, as Lennart indicated was possible, symlinks can be used in /proc/swaps then
the check must be done for symlinks as well.
src/core/swap.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/core/swap.c b/src/core/swap.c
index 97145a9..3b7808b 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -447,9 +447,13 @@ static int swap_process_new_swap(Manager *m, const char *device, int prio, bool
st.st_rdev != udev_device_get_devnum(d))
continue;
- k = swap_add_one(m, p, device, prio, false, false, set_flags);
- if (k < 0)
- r = k;
+ /* Skip p==device, since that case will be handled below */
+ if (!streq(p, device))
+ {
+ k = swap_add_one(m, p, device, prio, false, false, set_flags);
+ if (k < 0)
+ r = k;
+ }
}
udev_device_unref(d);
--
1.8.0
More information about the systemd-devel
mailing list