On Thu, Apr 12, 2012 at 9:47 PM, Cyrill Gorcunov <gorcunov@xxxxxxxxxx> wrote: > 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? Thanks, Cyrill. -- Asias He -- 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