From 2a25086dc452b22e0a473a0f47512e034c601c48 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Thu, 2 Aug 2007 08:35:07 -0600 Subject: [PATCH] swapoff: correctly handle UUID= and LABEL= identifiers While parsing /etc/fstab, swapoff did not make provision for UUID= and LABEL= identifiers. Added logic similar to swapon -a code. Signed-off-by: LaMont Jones --- mount/swapon.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mount/swapon.c b/mount/swapon.c index b4c84f95..0203287b 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -491,9 +491,18 @@ main_swapoff(int argc, char *argv[]) { exit(2); } while ((fstab = getmntent(fp)) != NULL) { - if (streq(fstab->mnt_type, MNTTYPE_SWAP) && - !is_in_proc_swaps(fstab->mnt_fsname)) - do_swapoff(fstab->mnt_fsname, QUIET); + const char *orig_special = fstab->mnt_fsname; + const char *special; + + if (!streq(fstab->mnt_type, MNTTYPE_SWAP)) + continue; + + special = fsprobe_get_devname(orig_special); + if (!special) + continue; + + if (!is_in_proc_swaps(special)) + do_swapoff(special, QUIET); } fclose(fp); } -- 2.39.5