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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to