diff options
author | LaMont Jones | 2007-08-05 02:04:11 +0200 |
---|---|---|
committer | Karel Zak | 2007-08-07 10:27:45 +0200 |
commit | 4ee7bde1441fa7ea8f85d05fc2d08d7dc5a24c1f (patch) | |
tree | 94b74fef56a95d2351d1e87932e87f8f6c3f0c57 /mount/swapon.c | |
parent | mount: fix incorrect behavior when more than one fs type is specified (diff) | |
download | kernel-qcow2-util-linux-4ee7bde1441fa7ea8f85d05fc2d08d7dc5a24c1f.tar.gz kernel-qcow2-util-linux-4ee7bde1441fa7ea8f85d05fc2d08d7dc5a24c1f.tar.xz kernel-qcow2-util-linux-4ee7bde1441fa7ea8f85d05fc2d08d7dc5a24c1f.zip |
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: Kel Modderman <kel@otaku42.de>
Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
Diffstat (limited to 'mount/swapon.c')
-rw-r--r-- | mount/swapon.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/mount/swapon.c b/mount/swapon.c index b4c84f958..0203287be 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); } |