]> err.no Git - util-linux/commitdiff
swapoff: correctly handle UUID= and LABEL= identifiers
authorLaMont Jones <lamont@mmjgroup.com>
Sun, 5 Aug 2007 00:04:11 +0000 (18:04 -0600)
committerKarel Zak <kzak@redhat.com>
Tue, 7 Aug 2007 08:27:45 +0000 (10:27 +0200)
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>
mount/swapon.c

index b4c84f9585f69dd827a588b14a30ce6cdc0f7704..0203287befde07c0e81095ac33440eaf0fd100dd 100644 (file)
@@ -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);
        }