Apply patch from Christophe.
parent
b1c1348d37
commit
bf91f7c0fc
|
@ -317,7 +317,7 @@ AC_FUNC_STAT
|
|||
AC_FUNC_STRFTIME
|
||||
AC_FUNC_UTIME_NULL
|
||||
AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \
|
||||
AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset realpath regcomp setlocale \
|
||||
strcasecmp strchr strdup strerror strtol strtoul utime mbsinit \
|
||||
setxattr getopt_long ])
|
||||
|
||||
|
|
|
@ -1277,10 +1277,13 @@ int ntfs_umount(ntfs_volume *vol,
|
|||
static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags)
|
||||
{
|
||||
struct mntent *mnt;
|
||||
#ifdef HAVE_REALPATH
|
||||
char *real_file = NULL, *real_fsname = NULL;
|
||||
#endif
|
||||
FILE *f;
|
||||
int err = 0;
|
||||
|
||||
#ifdef HAVE_REALPATH
|
||||
real_file = malloc(PATH_MAX + 1);
|
||||
if (!real_file)
|
||||
return -1;
|
||||
|
@ -1293,15 +1296,21 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags)
|
|||
err = errno;
|
||||
goto exit;
|
||||
}
|
||||
#endif
|
||||
if (!(f = setmntent(MOUNTED, "r"))) {
|
||||
err = errno;
|
||||
goto exit;
|
||||
}
|
||||
while ((mnt = getmntent(f))) {
|
||||
#ifdef HAVE_REALPATH
|
||||
if (!realpath(mnt->mnt_fsname, real_fsname))
|
||||
continue;
|
||||
if (!strcmp(real_file, real_fsname))
|
||||
break;
|
||||
#else
|
||||
if (!strcmp(file, mnt->mnt_fsname))
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
endmntent(f);
|
||||
if (!mnt)
|
||||
|
@ -1314,10 +1323,12 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags)
|
|||
*mnt_flags |= NTFS_MF_READONLY;
|
||||
#endif
|
||||
exit:
|
||||
#ifdef HAVE_REALPATH
|
||||
if (real_file)
|
||||
free(real_file);
|
||||
if (real_fsname)
|
||||
free(real_fsname);
|
||||
#endif
|
||||
if (err) {
|
||||
errno = err;
|
||||
return -1;
|
||||
|
|
|
@ -1375,6 +1375,7 @@ static int parse_options(int argc, char *argv[])
|
|||
err++;
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_REALPATH
|
||||
/* We don't want relative path in /etc/mtab. */
|
||||
if (argv[optind - 1][0] != '/') {
|
||||
if (!realpath(argv[optind - 1],
|
||||
|
@ -1387,6 +1388,9 @@ static int parse_options(int argc, char *argv[])
|
|||
}
|
||||
} else
|
||||
strcpy(opts.device, argv[optind - 1]);
|
||||
#else
|
||||
strcpy(opts.device, argv[optind - 1]);
|
||||
#endif
|
||||
} else if (!opts.mnt_point)
|
||||
opts.mnt_point = argv[optind - 1];
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue