]> git.sur5r.net Git - bacula/bacula/commitdiff
small bugfix for VSS-support (only relevant if WIN32_VSS enabled)
authorThorsten Engel <thorsten.engel@matrix-computer.com>
Tue, 17 May 2005 16:08:13 +0000 (16:08 +0000)
committerThorsten Engel <thorsten.engel@matrix-computer.com>
Tue, 17 May 2005 16:08:13 +0000 (16:08 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@2056 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/filed/job.c
bacula/src/win32/compat/compat.cpp

index b6c61f34a5d931a13990127fb76e0a8181c7e49f..b6f02c51b99ccb70654c627f99b8453c2165dc12 100644 (file)
@@ -1208,10 +1208,10 @@ static int backup_cmd(JCR *jcr)
    /* tell vss which drives to snapshot */   
    char szWinDriveLetters[27];   
    if (get_win32_driveletters((FF_PKT *)jcr->ff, szWinDriveLetters)) {
-      Jmsg(jcr, M_INFO, 0, _("Generate VSS snapshots. Drives=%s\n"), szWinDriveLetters);                 
+      Jmsg(jcr, M_INFO, 0, _("Generate VSS snapshots. Drives=%s\n"), szWinDriveLetters);
       g_VSSClient.CreateSnapshots(szWinDriveLetters);
 
-      for (int i=0; i<=strlen (szWinDriveLetters); i++) {
+      for (int i=0; i<strlen (szWinDriveLetters); i++) {
          if (islower(szWinDriveLetters[i]))
             Jmsg(jcr, M_WARNING, 0, _("Generate VSS snapshot of drive %c: failed\n"), szWinDriveLetters[i]);
       }
index 032bcaa72ff6a31f92433776bae578db498fe141..840c0404ddf6165a05a78341071b38b80177e15e 100644 (file)
@@ -80,10 +80,16 @@ cygwin_conv_to_win32_path(const char *name, char *win32_name, DWORD dwSize)
     }
 
 #ifdef WIN32_VSS
-    /* here we convert to VSS specific file name */    
-    char szFile[MAX_PATH_UNICODE];
-    strncpy (szFile, tname, MAX_PATH_UNICODE-1);
-    g_VSSClient.GetShadowPath(szFile,tname,dwSize);
+    /* here we convert to VSS specific file name which
+       can get longer because VSS will make something like
+       \\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy1\\bacula\\uninstall.exe
+       from c:\bacula\uninstall.exe
+    */    
+    POOLMEM* pszBuf = get_pool_memory (PM_FNAME);
+    pszBuf = check_pool_memory_size(pszBuf, dwSize);
+    bstrncpy (pszBuf, tname, strlen(tname)+1);
+    g_VSSClient.GetShadowPath(pszBuf,tname,dwSize);
+    free_pool_memory(pszBuf);
 #endif
 }
 
@@ -662,15 +668,20 @@ opendir(const char *path)
     if (tspec == NULL) return NULL;
 
     if (g_platform_id != VER_PLATFORM_WIN32_WINDOWS) {
-        // allow path to be 32767 bytes
-        tspec[0] = '\\';
-        tspec[1] = '\\';
-        tspec[2] = '?';
-        tspec[3] = '\\';
-        tspec[4] = 0;
-        cygwin_conv_to_win32_path(path, tspec+4, max_len-4);
+#ifdef WIN32_VSS
+       /* will append \\?\ at front itself */
+       cygwin_conv_to_win32_path(path, tspec, max_len-4);
+#else
+       /* allow path to be 32767 bytes */
+       tspec[0] = '\\';
+       tspec[1] = '\\';
+       tspec[2] = '?';
+       tspec[3] = '\\';
+       tspec[4] = 0;
+       cygwin_conv_to_win32_path(path, tspec+4, max_len-4);
+#endif
     } else {
-        cygwin_conv_to_win32_path(path, tspec, max_len);
+       cygwin_conv_to_win32_path(path, tspec, max_len);
     }
 
     strncat(tspec, "\\*", max_len);