From: Kern Sibbald Date: Tue, 18 Mar 2008 19:45:26 +0000 (+0000) Subject: kes Apply doc fix from bug #1062. X-Git-Tag: Release-7.0.0~4815 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ac2e40a9b011fd00ce9e2a08dc12f38d22e68136;p=bacula%2Fbacula kes Apply doc fix from bug #1062. kes Resolve crash and improper restore wx-console Win32 restore GUI. Fixes bug #1065. kes Update Win32 wxWidgets to latest version. kes Attempt to do correct handling of Win32 mount points. Should fix bug #1046. kes Fix Win32 FD backup/restore memory leak due to improper termination of BackupRead/Write. This fixes bug# 1038. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6628 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/baconfig.h b/bacula/src/baconfig.h index e54b08ed67..00f0a4c928 100644 --- a/bacula/src/baconfig.h +++ b/bacula/src/baconfig.h @@ -651,6 +651,9 @@ inline bool IsPathSeparator(int ch) { return ch == '/' || ch == '\\'; } inline char *first_path_separator(char *path) { return strpbrk(path, "/\\"); } inline const char *first_path_separator(const char *path) { return strpbrk(path, "/\\"); } +extern void pause_msg(const char *file, const char *func, int line, const char *msg); +#define pause(msg) if (debug_level) pause_msg(__FILE__, __func__, __LINE__, (msg)) + #else #define PathSeparator '/' /* Define Winsock functions if we aren't on Windows */ @@ -661,6 +664,7 @@ inline const char *first_path_separator(const char *path) { return strpbrk(path, inline bool IsPathSeparator(int ch) { return ch == '/'; } inline char *first_path_separator(char *path) { return strchr(path, '/'); } inline const char *first_path_separator(const char *path) { return strchr(path, '/'); } +#define pause(msg) #endif diff --git a/bacula/src/filed/restore.c b/bacula/src/filed/restore.c index 0a0aa6a25e..299b78f9e2 100644 --- a/bacula/src/filed/restore.c +++ b/bacula/src/filed/restore.c @@ -320,10 +320,10 @@ void do_restore(JCR *jcr) bclose(&rctx.bfd); } - /* TODO: manage deleted files */ - if (rctx.type == FT_DELETED) { /* deleted file */ - continue; - } + /* TODO: manage deleted files */ + if (rctx.type == FT_DELETED) { /* deleted file */ + continue; + } /* * Unpack attributes and do sanity check them @@ -1114,7 +1114,6 @@ int32_t extract_data(JCR *jcr, BFILE *bfd, POOLMEM *buf, int32_t buflen, * packet length may be re-read by unser_crypto_packet_len() */ cipher_ctx->packet_len = 0; } - return wsize; } diff --git a/bacula/src/findlib/attribs.c b/bacula/src/findlib/attribs.c index 275d196393..286944434a 100644 --- a/bacula/src/findlib/attribs.c +++ b/bacula/src/findlib/attribs.c @@ -376,7 +376,7 @@ bool set_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) mode_t old_mask; bool ok = true; boffset_t fsize; - + if (uid_set) { my_uid = getuid(); my_gid = getgid(); @@ -626,8 +626,9 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) POOLMEM *win32_ofile; // if we have neither ansi nor wchar version, we leave - if (!(p_SetFileAttributesW || p_SetFileAttributesA)) + if (!(p_SetFileAttributesW || p_SetFileAttributesA)) { return false; + } if (!p || !*p) { /* we should have attributes */ Dmsg2(100, "Attributes missing. of=%s ofd=%d\n", attr->ofname, ofd->fid); @@ -686,10 +687,9 @@ static bool set_win32_attributes(JCR *jcr, ATTR *attr, BFILE *ofd) } Dmsg1(100, "SetFileAtts %s\n", attr->ofname); - if (!(atts.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) - { + if (!(atts.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { if (p_SetFileAttributesW) { - POOLMEM* pwszBuf = get_pool_memory (PM_FNAME); + POOLMEM* pwszBuf = get_pool_memory(PM_FNAME); make_win32_path_UTF8_2_wchar(&pwszBuf, attr->ofname); BOOL b=p_SetFileAttributesW((LPCWSTR)pwszBuf, atts.dwFileAttributes & SET_ATTRS); diff --git a/bacula/src/findlib/bfile.c b/bacula/src/findlib/bfile.c index f5c961a419..10f867439b 100644 --- a/bacula/src/findlib/bfile.c +++ b/bacula/src/findlib/bfile.c @@ -54,6 +54,18 @@ boffset_t (*plugin_blseek)(JCR *jcr, boffset_t offset, int whence) = NULL; #define fdatasync(fd) #endif +#ifdef HAVE_WIN32 +void pause_msg(const char *file, const char *func, int line, const char *msg) +{ + char buf[1000]; + if (msg) { + bsnprintf(buf, sizeof(buf), "%s:%s:%d %s", file, func, line, msg); + } else { + bsnprintf(buf, sizeof(buf), "%s:%s:%d", file, func, line); + } + MessageBox(NULL, buf, "Pause", MB_OK); +} +#endif /* =============================================================== * @@ -140,16 +152,16 @@ void int64_LE2BE(int64_t* pBE, const int64_t v) { /* convert little endian to big endian */ if (htonl(1) != 1L) { /* no work if on little endian machine */ - memcpy(pBE, &v, sizeof(int64_t)); + memcpy(pBE, &v, sizeof(int64_t)); } else { - int i; - uint8_t rv[sizeof(int64_t)]; - uint8_t *pv = (uint8_t *) &v; - - for (i = 0; i < 8; i++) { - rv[i] = pv[7 - i]; - } - memcpy(pBE, &rv, sizeof(int64_t)); + int i; + uint8_t rv[sizeof(int64_t)]; + uint8_t *pv = (uint8_t *) &v; + + for (i = 0; i < 8; i++) { + rv[i] = pv[7 - i]; + } + memcpy(pBE, &rv, sizeof(int64_t)); } } @@ -158,16 +170,16 @@ void int32_LE2BE(int32_t* pBE, const int32_t v) { /* convert little endian to big endian */ if (htonl(1) != 1L) { /* no work if on little endian machine */ - memcpy(pBE, &v, sizeof(int32_t)); + memcpy(pBE, &v, sizeof(int32_t)); } else { - int i; - uint8_t rv[sizeof(int32_t)]; - uint8_t *pv = (uint8_t *) &v; - - for (i = 0; i < 4; i++) { - rv[i] = pv[3 - i]; - } - memcpy(pBE, &rv, sizeof(int32_t)); + int i; + uint8_t rv[sizeof(int32_t)]; + uint8_t *pv = (uint8_t *) &v; + + for (i = 0; i < 4; i++) { + rv[i] = pv[3 - i]; + } + memcpy(pBE, &rv, sizeof(int32_t)); } } @@ -553,9 +565,14 @@ int bclose(BFILE *bfd) goto all_done; } + /* + * We need to tell the API to release the buffer it + * allocated in lpContext. We do so by calling the + * API one more time, but with the Abort bit set. + */ if (bfd->use_backup_api && bfd->mode == BF_READ) { BYTE buf[10]; - if (!bfd->lpContext && !p_BackupRead(bfd->fh, + if (bfd->lpContext && !p_BackupRead(bfd->fh, buf, /* buffer */ (DWORD)0, /* bytes to read */ &bfd->rw_bytes, /* bytes read */ @@ -567,7 +584,7 @@ int bclose(BFILE *bfd) } } else if (bfd->use_backup_api && bfd->mode == BF_WRITE) { BYTE buf[10]; - if (!bfd->lpContext && !p_BackupWrite(bfd->fh, + if (bfd->lpContext && !p_BackupWrite(bfd->fh, buf, /* buffer */ (DWORD)0, /* bytes to read */ &bfd->rw_bytes, /* bytes written */ diff --git a/bacula/src/findlib/create_file.c b/bacula/src/findlib/create_file.c index 09a645c5bf..2028f475eb 100644 --- a/bacula/src/findlib/create_file.c +++ b/bacula/src/findlib/create_file.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2000-2007 Free Software Foundation Europe e.V. + Copyright (C) 2000-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. diff --git a/bacula/src/findlib/enable_priv.c b/bacula/src/findlib/enable_priv.c index fee72ae9c7..aac1716618 100644 --- a/bacula/src/findlib/enable_priv.c +++ b/bacula/src/findlib/enable_priv.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2003-2007 Free Software Foundation Europe e.V. + Copyright (C) 2003-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. diff --git a/bacula/src/findlib/mkpath.c b/bacula/src/findlib/mkpath.c index 38308ea575..9dd67893c9 100644 --- a/bacula/src/findlib/mkpath.c +++ b/bacula/src/findlib/mkpath.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-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. diff --git a/bacula/src/findlib/savecwd.c b/bacula/src/findlib/savecwd.c index 6e8bab8672..b0cb1e7cb9 100644 --- a/bacula/src/findlib/savecwd.c +++ b/bacula/src/findlib/savecwd.c @@ -1,7 +1,7 @@ /* Bacula® - The Network Backup Solution - Copyright (C) 2007-2007 Free Software Foundation Europe e.V. + Copyright (C) 2007-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. diff --git a/bacula/technotes-2.3 b/bacula/technotes-2.3 index d7bf709e83..a3c0d4611a 100644 --- a/bacula/technotes-2.3 +++ b/bacula/technotes-2.3 @@ -1,6 +1,15 @@ Technical notes on version 2.3 General: +18Mar08 +kes Apply doc fix from bug #1062. +kes Resolve crash and improper restore wx-console Win32 restore + GUI. Fixes bug #1065. +kes Update Win32 wxWidgets to latest version. +kes Attempt to do correct handling of Win32 mount points. Should + fix bug #1046. +kes Fix Win32 FD backup/restore memory leak due to improper termination + of BackupRead/Write. This fixes bug# 1038. 16Mar08 ebl Reduce memory usage for accurate backup, working only with ctime and mtime. (not all Lstat field)