From b50275e658e5327c5996e0f3656ab3215bc83ad0 Mon Sep 17 00:00:00 2001 From: Robert Nelson Date: Thu, 15 Mar 2007 10:31:52 +0000 Subject: [PATCH] Fix ACLS on zero length files on Windows. Add ENODATA definition for building using MSVC. Add new bsock.c to MSVC build. Fix exports for MSVC. Fix problem with icons not being removed for task bar on exit. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4345 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/filed/backup.c | 16 +++- bacula/src/win32/compat/compat.h | 4 + bacula/src/win32/libbac/libbac.vcproj | 16 +++- bacula/src/win32/libbac/msvc/bacula.def | 86 +++++++++++--------- bacula/src/win32/libwin32/wintray.cpp | 8 +- bacula/src/win32/stored/baculasd/wintray.cpp | 8 +- 6 files changed, 88 insertions(+), 50 deletions(-) diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 4af0603576..a4b9d74d4b 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -406,10 +406,20 @@ static int save_file(FF_PKT *ff_pkt, void *vjcr, bool top_level) * Note, if is_win32_backup, we must open the Directory so that * the BackupRead will save its permissions and ownership streams. */ - if (ff_pkt->type != FT_LNKSAVED && (S_ISREG(ff_pkt->statp.st_mode) && - ff_pkt->statp.st_size > 0) || - ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO || + bool do_read = false; + + if (ff_pkt->type != FT_LNKSAVED && S_ISREG(ff_pkt->statp.st_mode)) { +#ifdef HAVE_WIN32 + do_read = !is_portable_backup(&ff_pkt->bfd) || ff_pkt->statp.st_size > 0; +#else + do_read = ff_pkt->statp.st_size > 0; +#endif + } else if (ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO || (!is_portable_backup(&ff_pkt->bfd) && ff_pkt->type == FT_DIREND)) { + do_read = true; + } + + if (do_read) { btimer_t *tid; if (ff_pkt->type == FT_FIFO) { tid = start_thread_timer(pthread_self(), 60); diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 890e863428..0e25586b21 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -147,6 +147,10 @@ int gettimeofday(struct timeval *, struct timezone *); #define ENOMEDIUM 123 #endif +#if !defined(ENODATA) +#define ENODATA 61 +#endif + struct stat { _dev_t st_dev; diff --git a/bacula/src/win32/libbac/libbac.vcproj b/bacula/src/win32/libbac/libbac.vcproj index 7e7ebc353f..d8e1c6c8c1 100644 --- a/bacula/src/win32/libbac/libbac.vcproj +++ b/bacula/src/win32/libbac/libbac.vcproj @@ -454,6 +454,18 @@ /> + + + + + @@ -1585,11 +1597,11 @@ > AddTrayIcon(); @@ -297,6 +296,9 @@ LRESULT CALLBACK bacMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP } case WM_CLOSE: + if (bacService::RunningAsService()) { + _this->DelTrayIcon(); + } terminate_filed(0); break; diff --git a/bacula/src/win32/stored/baculasd/wintray.cpp b/bacula/src/win32/stored/baculasd/wintray.cpp index f755d17eb1..b9612cd442 100644 --- a/bacula/src/win32/stored/baculasd/wintray.cpp +++ b/bacula/src/win32/stored/baculasd/wintray.cpp @@ -113,7 +113,7 @@ bacMenu::bacMenu() bacMenu::~bacMenu() { // Remove the tray icon - SendTrayMsg(NIM_DELETE, 0); + DelTrayIcon(); // Destroy the loaded menu if (m_hmenu != NULL) @@ -136,7 +136,7 @@ bacMenu::DelTrayIcon() void bacMenu::UpdateTrayIcon(int bacstat) { - (void *)bac_status(NULL, 0); + (void)bac_status(NULL, 0); SendTrayMsg(NIM_MODIFY, bacstat); } @@ -215,7 +215,6 @@ LRESULT CALLBACK bacMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP // Every five seconds, a timer message causes the icon to update case WM_TIMER: - // *** HACK for running servicified if (bacService::RunningAsService()) { // Attempt to add the icon if it's not already there _this->AddTrayIcon(); @@ -297,6 +296,9 @@ LRESULT CALLBACK bacMenu::WndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lP } case WM_CLOSE: + if (bacService::RunningAsService()) { + _this->DelTrayIcon(); + } terminate_stored(0); break; -- 2.39.5