From: Jean-Pierre André Date: Mon, 22 Apr 2013 16:37:51 +0000 (+0200) Subject: Used /proc/mounts for checking existing mounts X-Git-Tag: android-x86-6.0-r1~71 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=20801dc6a025507926d879e7bd8a7205e8a479b3;p=android-x86%2Fexternal-ntfs-3g.git Used /proc/mounts for checking existing mounts The file /etc/mtab is traditionally checked to avoid multiple mountings of the same device, but this is not accurate enough in some conditions. So use /proc/mounts when available and fall back to /etc/mtab on systems which do not have /proc/mounts. --- diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c index 5bb266ff..edd76979 100644 --- a/libntfs-3g/volume.c +++ b/libntfs-3g/volume.c @@ -1433,7 +1433,8 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags) err = errno; goto exit; } - if (!(f = setmntent(MOUNTED, "r"))) { + f = setmntent("/proc/mounts", "r"); + if (!f && !(f = setmntent(MOUNTED, "r"))) { err = errno; goto exit; }