Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	(revision 35054)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceAutoMount.cpp	(revision 35055)
@@ -150,4 +150,7 @@
     }
 #endif
+
+    VBoxServiceVerbose(4, "VBoxServiceAutoMountShareIsMounted: Share \"%s\" at mount point \"%s\" = %s\n",
+                       pszShare, fMounted ? pszMountPoint : "<None>", fMounted ? "Yes" : "No");
     return fMounted;
 }
@@ -190,6 +193,14 @@
             rc = RTPathSetMode(pszMountPoint, fMode);
             if (RT_FAILURE(rc))
-                VBoxServiceError("VBoxServiceAutoMountPrepareMountPoint: Could not set mode %RTfmode for mount directory \"%s\", rc = %Rrc\n",
-                                 fMode, pszMountPoint, rc);
+            {
+                if (rc == VERR_WRITE_PROTECT)
+                {
+                    VBoxServiceError("VBoxServiceAutoMountPrepareMountPoint: Mount directory \"%s\" already is used/mounted\n", pszMountPoint);
+                    rc = VINF_SUCCESS;
+                }
+                else
+                    VBoxServiceError("VBoxServiceAutoMountPrepareMountPoint: Could not set mode %RTfmode for mount directory \"%s\", rc = %Rrc\n",
+                                     fMode, pszMountPoint, rc);
+            }
         }
         else
@@ -368,5 +379,5 @@
 }
 
-static int VBoxServiceAutoMountProcessMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings, uint32_t cMappings, 
+static int VBoxServiceAutoMountProcessMappings(PVBGLR3SHAREDFOLDERMAPPING paMappings, uint32_t cMappings,
                                                const char *pszMountDir, const char *pszSharePrefix, uint32_t uClientID)
 {
@@ -376,5 +387,4 @@
     AssertPtrReturn(pszMountDir, VERR_INVALID_PARAMETER);
     AssertPtrReturn(pszSharePrefix, VERR_INVALID_PARAMETER);
-    AssertPtrReturn(*pszSharePrefix, VERR_INVALID_PARAMETER);
     AssertReturn(uClientID > 0, VERR_INVALID_PARAMETER);
 
@@ -391,5 +401,5 @@
             char *pszShareNameFull = NULL;
             if (RTStrAPrintf(&pszShareNameFull, "%s%s", pszSharePrefix, pszShareName) > 0)
-            {                
+            {
                 char szMountPoint[RTPATH_MAX];
                 rc = RTPathJoin(szMountPoint, sizeof(szMountPoint), pszMountDir, pszShareNameFull);
@@ -397,5 +407,5 @@
                 {
                     VBoxServiceVerbose(4, "VBoxServiceAutoMountWorker: Processing mount point \"%s\"\n", szMountPoint);
-    
+
                     struct group *grp_vboxsf = getgrnam("vboxsf");
                     if (grp_vboxsf)
@@ -418,7 +428,5 @@
                             NULL,                  /* convertcp */
                         };
-    
-                        /* We always use "/media" as our root mounting directory. */
-                        /** @todo Detect the correct "media/mnt" directory, based on the current guest (?). */
+
                         rc = VBoxServiceAutoMountSharedFolder(pszShareName, szMountPoint, &mount_opts);
                     }
@@ -462,5 +470,6 @@
         rc = VbglR3SharedFolderGetMappings(u32ClientId, true /* Only process auto-mounted folders */,
                                            &paMappings, &cMappings);
-        if (RT_SUCCESS(rc))
+        if (   RT_SUCCESS(rc)
+            && cMappings)
         {
             char *pszMountDir;
@@ -474,7 +483,4 @@
                 char *pszSharePrefix;
                 rc = VbglR3SharedFolderGetMountPrefix(&pszSharePrefix);
-
-                {
-                }
                 if (RT_SUCCESS(rc))
                 {
@@ -501,9 +507,14 @@
             }
             else
-                VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder directory, rc = %Rrc\n", rc);                       
+                VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder directory, rc = %Rrc\n", rc);
             RTMemFree(paMappings);
         }
         else
-            VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder mappings, rc = %Rrc\n", rc);
+        {
+            if (RT_FAILURE(rc))
+                VBoxServiceError("VBoxServiceAutoMountWorker: Error while getting the shared folder mappings, rc = %Rrc\n", rc);
+            else if (!cMappings)
+                VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: No shared folder mappings fouund\n");
+        }
         VbglR3SharedFolderDisconnect(u32ClientId);
     }
@@ -512,6 +523,6 @@
     g_AutoMountEvent = NIL_RTSEMEVENTMULTI;
 
-    VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: Finished\n");
-    return 0;
+    VBoxServiceVerbose(3, "VBoxServiceAutoMountWorker: Finished with rc=%Rrc\n", rc);
+    return VINF_SUCCESS;
 }
 
