Re: [PATCH v2] kvm tools: Make raw block device work

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

 



On Thu, Apr 12, 2012 at 09:39:59PM +0800, 'Asias He wrote:
> +static bool is_mounted(struct stat *st)
> +{
> +	struct stat st_buf;
> +	struct mntent *mnt;
> +	FILE *f;
> +
> +	f = setmntent("/proc/mounts", "r");
> +	if (!f)
> +		return false;
> +
> +	while ((mnt = getmntent(f)) != NULL) {
> +		if (stat(mnt->mnt_fsname, &st_buf) == 0 &&
> +		    S_ISBLK(st_buf.st_mode) && st->st_rdev == st_buf.st_rdev)
> +			return true;
> +	}
> +
> +	return false;
> +}

fclose missed?

	Cyrill
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux