- Timestamp:
- Nov 8, 2010 1:28:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
r33834 r33837 33 33 #include <grp.h> 34 34 #include <sys/mount.h> 35 #include <mntent.h>36 #include <paths.h>37 35 #ifdef RT_OS_SOLARIS 38 #include <sys/vfs.h> 36 # include <sys/vfs.h> 37 # include <sys/mnttab.h> 38 #else 39 # include <mntent.h> 40 # include <paths.h> 39 41 #endif 40 42 #include <unistd.h> … … 50 52 #endif 51 53 54 #ifndef _PATH_MOUNTED 55 #define _PATH_MOUNTED "/etc/mtab" 56 #endif 57 52 58 /******************************************************************************* 53 59 * Global Variables * … … 87 93 88 94 89 static bool VBoxServiceAutoMountShareIsMounted(const char *pszShare, 95 static bool VBoxServiceAutoMountShareIsMounted(const char *pszShare, 90 96 char *pszMountPoint, size_t cbMountPoint) 91 97 { … … 109 115 if (!RTStrICmp(pMntEnt->mnt_fsname, pszShare)) 110 116 { 111 fMounted = RTStrPrintf(pszMountPoint, cbMountPoint, "%s", pMntEnt->mnt_dir) 112 ? true : false; 117 fMounted = RTStrPrintf(pszMountPoint, cbMountPoint, "%s", pMntEnt->mnt_dir) 118 ? true : false; 113 119 break; 114 } 115 } 120 } 121 } 116 122 endmntent(pFh); 117 123 } … … 131 137 r = umount(pszMountPoint); 132 138 if (r == 0) 133 break; 139 break; 134 140 RTThreadSleep(5000); /* Wait a while ... */ 135 141 } 136 142 if (r == -1) 137 143 rc = RTErrConvertFromErrno(errno); 138 return rc; 144 return rc; 139 145 } 140 146 … … 177 183 int rc; 178 184 char szAlreadyMountedTo[RTPATH_MAX]; 179 /* If a Shared Folder already is mounted but not to our desired mount point, 185 /* If a Shared Folder already is mounted but not to our desired mount point, 180 186 * do an unmount first! */ 181 187 if ( VBoxServiceAutoMountShareIsMounted(pszShareName, szAlreadyMountedTo, sizeof(szAlreadyMountedTo)) 182 188 && RTStrICmp(pszMountPoint, szAlreadyMountedTo)) 183 189 { 184 VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: Shared folder \"%s\" already mounted to \"%s\", unmounting ...\n", 190 VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: Shared folder \"%s\" already mounted to \"%s\", unmounting ...\n", 185 191 pszShareName, szAlreadyMountedTo); 186 192 rc = VBoxServiceAutoMountUnmount(szAlreadyMountedTo); … … 315 321 VBoxServiceVerbose(0, "VBoxServiceAutoMountWorker: Shared folder \"%s\" already is mounted!\n", pszShareName); 316 322 /* Ignore this error! */ 317 break; 323 break; 318 324 case EBUSY: 319 325 /* Ignore these errors! */ … … 325 331 rc = RTErrConvertFromErrno(errno); 326 332 break; 327 } 333 } 328 334 } 329 335 }
Note:
See TracChangeset
for help on using the changeset viewer.