Re: [PATCH] swapoff: correctly handle UUID= and LABEL= identifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 04, 2007 at 06:04:11PM -0600, LaMont Jones wrote:
> While parsing /etc/fstab, swapoff did not make provision for UUID= and
> LABEL= identifiers.  Added logic similar to swapon -a code.

 Not true. See do_swapoff() where is fsprobe_get_devname().

>  mount/swapon.c |   15 ++++++++++++---
>  1 files changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/mount/swapon.c b/mount/swapon.c
> index b4c84f9..0203287 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);

 Well, I'll apply this patch, because the old

    is_in_proc_swaps(fstab->mnt_fsname)

 is incorrect. The function is_in_proc_swaps() works with paths only.

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux