From bf91f7c0fc094a361d01614a385002c4975a6746 Mon Sep 17 00:00:00 2001 From: cha0smaster Date: Mon, 10 Oct 2005 11:04:56 +0000 Subject: [PATCH] Apply patch from Christophe. --- configure.ac | 2 +- libntfs/volume.c | 11 +++++++++++ ntfsprogs/ntfsmount.c | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f62ed5d0..4037ec24 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) diff --git a/libntfs/volume.c b/libntfs/volume.c index 984a06ae..b1adb11f 100644 --- a/libntfs/volume.c +++ b/libntfs/volume.c @@ -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; diff --git a/ntfsprogs/ntfsmount.c b/ntfsprogs/ntfsmount.c index b615dc41..fccc175d 100644 --- a/ntfsprogs/ntfsmount.c +++ b/ntfsprogs/ntfsmount.c @@ -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 {