From: Kern Sibbald Date: Sun, 10 Jun 2012 07:41:05 +0000 (+0200) Subject: Enhance Win32 error messages -- fixes bug #1879 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dd6c2bc4916e6048ffe032c4e1c49b4c729088a5;p=bacula%2Fbacula Enhance Win32 error messages -- fixes bug #1879 --- diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 6636cc11d0..61164699df 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1907,7 +1907,9 @@ static int backup_cmd(JCR *jcr) if (get_win32_driveletters(jcr->ff, szWinDriveLetters)) { Jmsg(jcr, M_INFO, 0, _("Generate VSS snapshots. Driver=\"%s\", Drive(s)=\"%s\"\n"), g_pVSSClient->GetDriverName(), szWinDriveLetters); if (!g_pVSSClient->CreateSnapshots(szWinDriveLetters)) { - Jmsg(jcr, M_FATAL, 0, _("CreateSGenerate VSS snapshots failed.\n")); + berrno be; + Jmsg(jcr, M_FATAL, 0, _("CreateSGenerate VSS snapshots failed. ERR=%s\n"), + be.bstrerror()); } else { /* tell user if snapshot creation of a specific drive failed */ int i; @@ -1927,7 +1929,9 @@ static int backup_cmd(JCR *jcr) Jmsg(jcr, M_FATAL, 0, _("No drive letters found for generating VSS snapshots.\n")); } } else { - Jmsg(jcr, M_FATAL, 0, _("VSS was not initialized properly.\n")); + berrno be; + Jmsg(jcr, M_FATAL, 0, _("VSS was not initialized properly. ERR=%s\n"), + be.bstrerror()); } run_scripts(jcr, jcr->RunScripts, "ClientAfterVSS"); } diff --git a/bacula/src/win32/filed/vss_generic.cpp b/bacula/src/win32/filed/vss_generic.cpp index 69f9d72b82..7b718e87b7 100644 --- a/bacula/src/win32/filed/vss_generic.cpp +++ b/bacula/src/win32/filed/vss_generic.cpp @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2005-2010 Free Software Foundation Europe e.V. + Copyright (C) 2005-2012 Free Software Foundation Europe e.V. The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -231,7 +231,8 @@ VSSClientGeneric::~VSSClientGeneric() } // Initialize the COM infrastructure and the internal pointers -bool VSSClientGeneric::Initialize(DWORD dwContext, bool bDuringRestore, bool (*VssInitCallback)(JCR *, int)) +bool VSSClientGeneric::Initialize(DWORD dwContext, bool bDuringRestore, + bool (*VssInitCallback)(JCR *, int)) { CComPtr pAsync1; VSS_BACKUP_TYPE backup_type; @@ -286,9 +287,8 @@ bool VSSClientGeneric::Initialize(DWORD dwContext, bool bDuringRestore, bool (*V // Create the internal backup components object hr = p_CreateVssBackupComponents((IVssBackupComponents**) &m_pVssObject); if (FAILED(hr)) { - berrno be; - Dmsg2(0, "VSSClientGeneric::Initialize: CreateVssBackupComponents returned 0x%08X. ERR=%s\n", - hr, be.bstrerror(b_errno_win32)); + Dmsg1(0, "VSSClientGeneric::Initialize: CreateVssBackupComponents returned 0x%08X.\n", + hr); errno = b_errno_win32; return false; } @@ -354,21 +354,6 @@ bool VSSClientGeneric::Initialize(DWORD dwContext, bool bDuringRestore, bool (*V HRESULT hr; -#if 0 - WCHAR *xml; - int fd; - struct stat stat; - /* obviously this is just temporary - the xml should come from somewhere like the catalog */ - fd = open("C:\\james.xml", O_RDONLY); - Dmsg1(0, "fd = %d\n", fd); - fstat(fd, &stat); - Dmsg1(0, "size = %d\n", stat.st_size); - xml = new WCHAR[stat.st_size / sizeof(WCHAR) + 1]; - read(fd, xml, stat.st_size); - close(fd); - xml[stat.st_size / sizeof(WCHAR)] = 0; -#endif - // 1. InitializeForRestore hr = ((IVssBackupComponents*) m_pVssObject)->InitializeForRestore(m_metadata); if (FAILED(hr)) {