From: VMware, Inc <> Date: Mon, 21 Nov 2011 23:26:59 +0000 (-0800) Subject: DnD: fix vmblock-fuse detection on newer Linuxes X-Git-Tag: 2011.11.20-535097~35 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ebbba9f33eb589eb4a4ed0c49e26fcc8cd076e8;p=thirdparty%2Fopen-vm-tools.git DnD: fix vmblock-fuse detection on newer Linuxes Newer Linuxes, such as Fedora 15 and Ubuntu 11.10, have /var/run symlinked to /run so when we read existing mount points in search of fuse.vmware-vmblock our matching on /var/run/vmblock-fuse does not work anymore. Try to resolve supplied mount point before comparing with mount data. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c b/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c index 8d456d0c4..31a8a80a9 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndLinux.c @@ -548,15 +548,29 @@ DnD_TryInitVmblock(const char *vmbFsName, // IN { Bool found = FALSE; int blockFd = -1; + char *realMntPoint; MNTHANDLE fp; DECLARE_MNTINFO(mnt); + ASSERT(vmbFsName); + ASSERT(vmbMntPoint); + ASSERT(vmbDevice); + + /* Resolve desired mount point in case it is symlinked somewhere */ + realMntPoint = Posix_RealPath(vmbMntPoint); + if (!realMntPoint) { + /* + * If resolve failed for some reason try to fall back to + * original mount point specification. + */ + realMntPoint = Util_SafeStrdup(vmbMntPoint); + } + /* Make sure the vmblock file system is mounted. */ fp = OPEN_MNTFILE("r"); if (fp == NULL) { LOG(1, ("%s: could not open mount file\n", __func__)); - - return -1; + goto out; } while (GETNEXT_MNTINFO(fp, mnt)) { @@ -566,7 +580,7 @@ DnD_TryInitVmblock(const char *vmbFsName, // IN */ if (strcmp(MNTINFO_FSTYPE(mnt), vmbFsName) == 0 && - strcmp(MNTINFO_MNTPT(mnt), vmbMntPoint) == 0) { + strcmp(MNTINFO_MNTPT(mnt), realMntPoint) == 0) { found = TRUE; break; } @@ -592,6 +606,8 @@ DnD_TryInitVmblock(const char *vmbFsName, // IN } } +out: + free(realMntPoint); return blockFd; }