rx.JobIds = (char *)"";
rx.bsr->JobId = jcr->previous_jr.JobId;
ua = new_ua_context(jcr);
- complete_bsr(ua, rx.bsr);
+ if (!complete_bsr(ua, rx.bsr)) {
+ goto bail_out;
+ }
rx.bsr->fi = new_findex();
rx.bsr->fi->findex = 1;
rx.bsr->fi->findex2 = jcr->previous_jr.JobFiles;
jcr->ExpectedFiles = write_bsr_file(ua, rx);
if (jcr->ExpectedFiles == 0) {
- free_ua_context(ua);
- free_bsr(rx.bsr);
- return false;
+ goto bail_out;
}
free_ua_context(ua);
free_bsr(rx.bsr);
jcr->needs_sd = true;
return true;
+
+bail_out:
+ free_ua_context(ua);
+ free_bsr(rx.bsr);
+ return false;
}
/* TODO: redirect command ouput to job log */
}
dir->fsend(OKbackup);
- Dmsg1(110, "bfiled>dird: %s", dir->msg);
+ Dmsg1(110, "filed>dird: %s", dir->msg);
/*
* Send Append Open Session to Storage daemon
generate_plugin_event(jcr, bEventLevel, (void *)jcr->get_JobLevel());
generate_plugin_event(jcr, bEventStartVerifyJob);
- Dmsg1(110, "bfiled>dird: %s", dir->msg);
+ Dmsg1(110, "filed>dird: %s", dir->msg);
switch (jcr->get_JobLevel()) {
case L_VERIFY_INIT:
* Send Close session command to Storage daemon
*/
sd->fsend(read_close, jcr->Ticket);
- Dmsg1(130, "bfiled>stored: %s", sd->msg);
+ Dmsg1(130, "filed>stored: %s", sd->msg);
/* ****FIXME**** check response */
bget_msg(sd); /* get OK */
jcr->prefix_links = prefix_links;
dir->fsend(OKrestore);
- Dmsg1(110, "bfiled>dird: %s", dir->msg);
+ Dmsg1(110, "filed>dird: %s", dir->msg);
jcr->set_JobType(JT_RESTORE);
* Send Close session command to Storage daemon
*/
sd->fsend(read_close, jcr->Ticket);
- Dmsg1(130, "bfiled>stored: %s", sd->msg);
+ Dmsg1(130, "filed>stored: %s", sd->msg);
bget_msg(sd); /* get OK */
* Get ticket number
*/
if (bget_msg(sd) >= 0) {
- Dmsg1(110, "bfiled<stored: %s", sd->msg);
+ Dmsg1(110, "filed<stored: %s", sd->msg);
if (sscanf(sd->msg, OK_open, &jcr->Ticket) != 1) {
Jmsg(jcr, M_FATAL, 0, _("Bad response to SD read open: %s\n"), sd->msg);
return 0;
}
- Dmsg1(110, "bfiled: got Ticket=%d\n", jcr->Ticket);
+ Dmsg1(110, "filed: got Ticket=%d\n", jcr->Ticket);
} else {
Jmsg(jcr, M_FATAL, 0, _("Bad response from stored to read open command\n"));
return 0;
free_pool_memory(win32_fname);
return bfd->mode == BF_CLOSED ? -1 : 1;
}
- Dmsg0(50, "=== NOT plugin\n");
+ Dmsg0(50, "=== NO plugin\n");
- if (!(p_CreateFileA || p_CreateFileW))
+ if (!(p_CreateFileA || p_CreateFileW)) {
+ Dmsg0(50, "No CreateFileA and no CreateFileW!!!!!\n");
return 0;
+ }
- if (p_CreateFileW && p_MultiByteToWideChar)
+ if (p_CreateFileW && p_MultiByteToWideChar) {
make_win32_path_UTF8_2_wchar(&win32_fname_wchar, fname);
+ }
if (flags & O_CREAT) { /* Create */
if (bfd->use_backup_api) {
if (p_CreateFileW && p_MultiByteToWideChar) {
// unicode open for create write
+ Dmsg1(100, "Create CreateFileW=%s\n", win32_fname);
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
0, /* Shared mode */
NULL); /* TemplateFile */
} else {
// ascii open
+ Dmsg1(100, "Create CreateFileA=%s\n", win32_fname);
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
0, /* Shared mode */
if (p_CreateFileW && p_MultiByteToWideChar) {
// unicode open for open existing write
+ Dmsg1(100, "Write only CreateFileW=%s\n", win32_fname);
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
0, /* Shared mode */
NULL); /* TemplateFile */
} else {
// ascii open
+ Dmsg1(100, "Write only CreateFileA=%s\n", win32_fname);
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
0, /* Shared mode */
if (p_CreateFileW && p_MultiByteToWideChar) {
// unicode open for open existing read
+ Dmsg1(100, "Read CreateFileW=%s\n", win32_fname);
bfd->fh = p_CreateFileW((LPCWSTR)win32_fname_wchar,
dwaccess, /* Requested access */
dwshare, /* Share modes */
NULL); /* TemplateFile */
} else {
// ascii open
+ Dmsg1(100, "Read CreateFileA=%s\n", win32_fname);
bfd->fh = p_CreateFileA(win32_fname,
dwaccess, /* Requested access */
dwshare, /* Share modes */
if (trace) {
if (!trace_fd) {
char fn[200];
- bsnprintf(fn, sizeof(fn), "%s/%s.trace", working_directory ? working_directory : ".", my_name);
+ bsnprintf(fn, sizeof(fn), "%s/%s.trace", working_directory ? working_directory : "./", my_name);
trace_fd = fopen(fn, "a+b");
}
if (trace_fd) {
-/*
- * Parse a Bootstrap Records (used for restores)
- *
- * Kern Sibbald, June MMII
- *
- * Version $Id$
- */
/*
Bacula® - The Network Backup Solution
- Copyright (C) 2002-2006 Free Software Foundation Europe e.V.
+ Copyright (C) 2002-2008 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.
(FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
Switzerland, email:ftf@fsfeurope.org.
*/
+/*
+ * Parse a Bootstrap Records (used for restores)
+ *
+ * Kern Sibbald, June MMII
+ *
+ * Version $Id$
+ */
#include "bacula.h"
*/
#undef VERSION
-#define VERSION "2.5.24"
-#define BDATE "16 December 2008"
-#define LSMDATE "16Dec08"
+#define VERSION "2.5.25"
+#define BDATE "20 December 2008"
+#define LSMDATE "20Dec08"
#define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
#define BYEAR "2008" /* year for copyright messages in progs */
fi ; \
fi
-Makefile.inc: Makefile.inc.in
+Makefile.inc: Makefile.inc.in Makefile
@echo Creating $@
$(ECHO_CMD)TOPDIR=`(cd ../../..;pwd)`; \
if test -e ../../../cross-tools/mingw32/bin/mingw32-gcc; then \
$(ECHO_CMD)BUILDDIR=`(pwd)`; \
$(ECHO_CMD)MAINDIR=`(cd ../..;pwd)`; \
sed \
- -e "s^@WIN3wBUILDDIR@^$${BUILDDIR}^" \
+ -e "s^@WIN32BUILDDIR@^$${BUILDDIR}^" \
-e "s^@WIN32MAINDIR@^$${MAINDIR}^" \
-e "s^@WIN32TOPDIR@^$${TOPDIR}^" \
-e "s^@WIN32BINDIR@^$${BINDIR}^" \
_Z21db_list_files_for_jobP3JCRP4B_DBjPFvPvPKcES3_\r
_Z21db_list_media_recordsP3JCRP4B_DBP9MEDIA_DBRPFvPvPKcES5_11e_list_type\r
_Z22db_list_client_recordsP3JCRP4B_DBPFvPvPKcES3_11e_list_type\r
+_Z22db_list_joblog_recordsP3JCRP4B_DBjPFvPvPKcES3_11e_list_type\r
_Z24db_list_jobmedia_recordsP3JCRP4B_DBjPFvPvPKcES3_11e_list_type\r
\r
; sql_update.o\r
POOLMEM* pwszBuf = get_pool_memory (PM_FNAME);
make_win32_path_UTF8_2_wchar(&pwszBuf, file);
+ Dmsg1(100, "FindFirstFileW=%s\n", file);
h = p_FindFirstFileW((LPCWSTR)pwszBuf, &info_w);
free_pool_memory(pwszBuf);
// use ASCII
} else if (p_FindFirstFileA) {
+ Dmsg1(100, "FindFirstFileA=%s\n", file);
h = p_FindFirstFileA(file, &info_a);
pdwFileAttributes = &info_a.dwFileAttributes;
pftLastAccessTime = &info_a.ftLastAccessTime;
pftLastWriteTime = &info_a.ftLastWriteTime;
pftCreationTime = &info_a.ftCreationTime;
+ } else {
+ Dmsg0(100, "No findFirstFile A or W found\n");
}
if (h == INVALID_HANDLE_VALUE) {
const char *err = errorString();
- Dmsg2(99, "FindFirstFile(%s):%s\n", file, err);
+ /*
+ * Note, in creating leading paths, it is normal that
+ * the file does not exist.
+ */
+ Dmsg2(2099, "FindFirstFile(%s):%s\n", file, err);
LocalFree((void *)err);
errno = b_errno_win32;
return -1;
if (!GetFileInformationByHandle((HANDLE)fd, &info)) {
const char *err = errorString();
- Dmsg1(99, "GetfileInformationByHandle: %s\n", err);
+ Dmsg1(2099, "GetfileInformationByHandle: %s\n", err);
LocalFree((void *)err);
errno = b_errno_win32;
return -1;
static int
stat2(const char *file, struct stat *sb)
{
- HANDLE h;
+ HANDLE h = INVALID_HANDLE_VALUE;
int rval = 0;
char tmpbuf[5000];
conv_unix_to_win32_path(file, tmpbuf, 5000);
make_win32_path_UTF8_2_wchar(&pwszBuf, tmpbuf);
attr = p_GetFileAttributesW((LPCWSTR) pwszBuf);
+ if (p_CreateFileW) {
+ h = CreateFileW((LPCWSTR)pwszBuf, GENERIC_READ,
+ FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
+ }
free_pool_memory(pwszBuf);
} else if (p_GetFileAttributesA) {
attr = p_GetFileAttributesA(tmpbuf);
+ h = CreateFileA(tmpbuf, GENERIC_READ,
+ FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
}
if (attr == (DWORD)-1) {
const char *err = errorString();
- Dmsg2(99, "GetFileAttributes(%s): %s\n", tmpbuf, err);
+ Dmsg2(2099, "GetFileAttributes(%s): %s\n", tmpbuf, err);
LocalFree((void *)err);
+ if (h != INVALID_HANDLE_VALUE) {
+ CloseHandle(h);
+ }
errno = b_errno_win32;
return -1;
}
- h = CreateFileA(tmpbuf, GENERIC_READ,
- FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
-
if (h == INVALID_HANDLE_VALUE) {
const char *err = errorString();
- Dmsg2(99, "Cannot open file for stat (%s):%s\n", tmpbuf, err);
+ Dmsg2(2099, "Cannot open file for stat (%s):%s\n", tmpbuf, err);
LocalFree((void *)err);
errno = b_errno_win32;
return -1;
if (attr & FILE_ATTRIBUTE_DIRECTORY &&
file[1] == ':' && file[2] != 0) {
- statDir(file, sb);
+ rval = statDir(file, sb);
}
-
return rval;
}
{
DWORD attr = (DWORD)-1;
+ Dmsg1(100, "Enter win32_chmod. path=%s\n", path);
if (p_GetFileAttributesW) {
POOLMEM* pwszBuf = get_pool_memory(PM_FNAME);
make_win32_path_UTF8_2_wchar(&pwszBuf, path);
attr = p_SetFileAttributesW((LPCWSTR)pwszBuf, attr);
}
free_pool_memory(pwszBuf);
+ Dmsg0(100, "Leave win32_chmod. AttributesW\n");
} else if (p_GetFileAttributesA) {
if (mode & (S_IRUSR|S_IRGRP|S_IROTH)) {
attr |= FILE_ATTRIBUTE_READONLY;
if (attr != INVALID_FILE_ATTRIBUTES) {
attr = p_SetFileAttributesA(path, attr);
}
+ Dmsg0(100, "Leave win32_chmod did AttributesA\n");
+ } else {
+ Dmsg0(100, "Leave win32_chmod did nothing\n");
}
+
if (attr == (DWORD)-1) {
const char *err = errorString();
int
win32_mkdir(const char *dir)
{
+ Dmsg1(100, "enter win32_mkdir. dir=%s\n", dir);
if (p_wmkdir){
POOLMEM* pwszBuf = get_pool_memory(PM_FNAME);
make_win32_path_UTF8_2_wchar(&pwszBuf, dir);
int n = p_wmkdir((LPCWSTR)pwszBuf);
free_pool_memory(pwszBuf);
+ Dmsg0(100, "Leave win32_mkdir did wmkdir\n");
return n;
}
+ Dmsg0(100, "Leave win32_mkdir did _mkdir\n");
return _mkdir(dir);
}
mixed priorities
General:
+20Dec08
+kes Correct typo in Win32 Makefile editing
+kes Correct typos in debug output.
+kes Improved error detection in creating bsrs.
+kes Add debug code to Win32 restore
19Dec08
+kes Fix Win32 build.
ebl Cleanup director VolParam struct
18Dec08
ebl Replace File:Block in BSR by Address to fix #1190