block: properly handle vlist_add() for label, uuid and device cases
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 5 Sep 2013 15:19:41 +0000 (17:19 +0200)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 5 Sep 2013 15:20:07 +0000 (17:20 +0200)
block.c

diff --git a/block.c b/block.c
index d4cf08945592af608b3485b50cc794267ae3f3b7..c9285d642ad8346bbb10dede5c9df2af99828ded 100644 (file)
--- a/block.c
+++ b/block.c
@@ -302,7 +302,13 @@ static int swap_add(struct uci_section *s)
                /* store complete swap path */
                if (tb[SWAP_DEVICE])
                        m->target = blobmsg_get_strdup(tb[SWAP_DEVICE]);
-               vlist_add(&mounts, &m->node, (m->uuid) ? (m->uuid) : (m->device));
+
+               if (m->uuid)
+                       vlist_add(&mounts, &m->node, m->uuid);
+               else if (m->label)
+                       vlist_add(&mounts, &m->node, m->label);
+               else if (m->device)
+                       vlist_add(&mounts, &m->node, m->device);
        }
 
        return 0;