]> git.sur5r.net Git - bacula/bacula/commitdiff
fixed bug on restore due to mingw handling of wide strings.
authorJames Harper <james.harper@bendigoit.com.au>
Thu, 30 Oct 2008 09:15:49 +0000 (09:15 +0000)
committerJames Harper <james.harper@bendigoit.com.au>
Thu, 30 Oct 2008 09:15:49 +0000 (09:15 +0000)
tuned debugging values slightly.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7945 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/win32/filed/plugins/file_node.c
bacula/src/win32/filed/plugins/storage_group_node.c

index 6af291d130eeae61cd8882ca6b70198393a0cbd9..a200faf1cf47753a42276ba9dc441f0bde04ee6d 100644 (file)
@@ -111,13 +111,15 @@ file_node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io)
 {
         HRESULT result;
         HANDLE handle;
+        char *tmp = new char[wcslen(filename) + 1];
+        wcstombs(tmp, filename, wcslen(filename) + 1);
 
-        _DebugMessage(100, "pluginIoOpen_FILE - filename = %S\n", filename);
+        _DebugMessage(0, "pluginIoOpen_FILE - filename = %s\n", tmp);
         io->status = 0;
         io->io_errno = 0;
         if (context->job_type == JOB_TYPE_BACKUP)
         {
-                _DebugMessage(100, "Calling HrESEBackupOpenFile\n");
+                _DebugMessage(10, "Calling HrESEBackupOpenFile\n");
                 result = HrESEBackupOpenFile(hccx, filename, 65535, 1, &backup_file_handle, &section_size);
                 if (result)
                 {
@@ -129,11 +131,12 @@ file_node_t::pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io)
         }
         else
         {
-                _DebugMessage(100, "Calling HrESERestoreOpenFile\n");
+                _DebugMessage(10, "Calling HrESERestoreOpenFile for '%s'\n", tmp);
                 result = HrESERestoreOpenFile(hccx, filename, 1, &restore_file_handle);
                 if (result == hrRestoreAtFileLevel)
                 {
                         restore_at_file_level = true;
+                       _DebugMessage(100, "Calling CreateFileW for '%s'\n", tmp);
                         handle = CreateFileW(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
                         if (handle == INVALID_HANDLE_VALUE)
                         {
index d6c453ed9e38277dab0b183dbe0d58d428ae5638..b9f111a80e4e2595df68999956fb9f3f6ed4ec9e 100644 (file)
@@ -171,7 +171,6 @@ storage_group_node_t::startBackupFile(exchange_fd_context_t *context, struct sav
                                 if (!include_file)
                                 {
                                         tmp_time = (((int64_t)modified_time.dwHighDateTime) << 32) | modified_time.dwLowDateTime;
-                                        //FIXME: this is too big according to mingw
                                         tmp_time -= 116444736000000000LL;
                                         tmp_time /= 10000000;
                                         if (tmp_time > context->job_since)
@@ -413,8 +412,9 @@ storage_group_node_t::createFile(exchange_fd_context_t *context, struct restore_
                         }
                         len = wcslen(restore_environment->m_wszRestoreLogPath) + strlen(file_node->name + i) + 1 + 1;
                         file_node->filename = new WCHAR[len];
-                        // FIXME: %S not supported under mingw
-                        //swprintf(file_node->filename, len, L"%s\\%S", restore_environment->m_wszRestoreLogPath, file_node->name + i);
+                       wcscpy(file_node->filename, restore_environment->m_wszRestoreLogPath);
+                       wcscat(file_node->filename, L"\\");
+                       mbstowcs(&file_node->filename[wcslen(file_node->filename)], file_node->name + i, strlen(file_node->name + i) + 1);
                         context->current_node = file_node;
                         return bRC_OK;
                 case 3: