From dde72dc2340ee538b5d23177aa93e7d5acce7b33 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 7 Oct 2006 21:09:43 +0000 Subject: [PATCH] kes Begin work on new GUI console. kes Make configure look in non-standard MySQL library directory for Solaris. kes Make mtx-changer automatically configure the autochanger wait procedure for Solaris, FreeBSD, and Linux. Previously, only Linux was implemented. kes Correct drop_sqlite_tables.in script to not delete the database. kes When writing to a log file, close and reopen the file descriptor if there is an error writing the file. kes Modify the autochanger loaded?, load, and unload commands to print the full text of any mtx output if there is an error. Helps to ease diagnosis of autochanger problems. kes Correct a few Win32 errno returns in the VSS code so that hopefully a resonable Win32 error message will be printed. kes Convert a few strcat()... to bstrncat() in the Win32 code. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3539 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/bacula-macros/db.m4 | 132 +++++++++++---------- bacula/configure | 138 +++++++++++----------- bacula/scripts/mtx-changer.in | 22 +++- bacula/src/cats/create_sqlite_database.in | 7 +- bacula/src/cats/drop_sqlite_tables.in | 5 +- bacula/src/lib/message.c | 55 +++++---- bacula/src/stored/autochanger.c | 33 +++--- bacula/src/stored/btape.c | 2 +- bacula/src/tray-monitor/tray_conf.c | 19 ++- bacula/src/version.h | 6 +- bacula/src/win32/filed/vss.cpp | 26 ++-- bacula/src/win32/filed/vss_generic.cpp | 22 ++-- bacula/technotes-1.39 | 20 +++- 13 files changed, 264 insertions(+), 223 deletions(-) diff --git a/bacula/autoconf/bacula-macros/db.m4 b/bacula/autoconf/bacula-macros/db.m4 index a5238bae69..e70564f0ab 100644 --- a/bacula/autoconf/bacula-macros/db.m4 +++ b/bacula/autoconf/bacula-macros/db.m4 @@ -10,71 +10,75 @@ AC_ARG_WITH(mysql, [ if test "$withval" != "no"; then if test "$withval" = "yes"; then - if test -f /usr/local/mysql/include/mysql/mysql.h; then - MYSQL_INCDIR=/usr/local/mysql/include/mysql - if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql - else - MYSQL_LIBDIR=/usr/local/mysql/lib/mysql - fi - MYSQL_BINDIR=/usr/local/mysql/bin - elif test -f /usr/include/mysql/mysql.h; then - MYSQL_INCDIR=/usr/include/mysql - if test -f /usr/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/lib64/mysql - else - MYSQL_LIBDIR=/usr/lib/mysql - fi - MYSQL_BINDIR=/usr/bin - elif test -f /usr/include/mysql.h; then - MYSQL_INCDIR=/usr/include - if test -f /usr/lib64/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/lib64 - else - MYSQL_LIBDIR=/usr/lib - fi - MYSQL_BINDIR=/usr/bin - elif test -f /usr/local/include/mysql/mysql.h; then - MYSQL_INCDIR=/usr/local/include/mysql - if test -f /usr/local/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/local/lib64/mysql - else - MYSQL_LIBDIR=/usr/local/lib/mysql - fi - MYSQL_BINDIR=/usr/local/bin - elif test -f /usr/local/include/mysql.h; then - MYSQL_INCDIR=/usr/local/include - if test -f /usr/local/lib64/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/local/lib64 - else - MYSQL_LIBDIR=/usr/local/lib - fi - MYSQL_BINDIR=/usr/local/bin - else - AC_MSG_RESULT(no) - AC_MSG_ERROR(Unable to find mysql.h in standard locations) - fi + if test -f /usr/local/mysql/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/mysql/include/mysql + if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql + else + MYSQL_LIBDIR=/usr/local/mysql/lib/mysql + fi + MYSQL_BINDIR=/usr/local/mysql/bin + elif test -f /usr/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/include/mysql + if test -f /usr/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/lib64/mysql + else + MYSQL_LIBDIR=/usr/lib/mysql + fi + MYSQL_BINDIR=/usr/bin + elif test -f /usr/include/mysql.h; then + MYSQL_INCDIR=/usr/include + if test -f /usr/lib64/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/lib64 + else + MYSQL_LIBDIR=/usr/lib + fi + MYSQL_BINDIR=/usr/bin + elif test -f /usr/local/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/include/mysql + if test -f /usr/local/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/local/lib64/mysql + else + MYSQL_LIBDIR=/usr/local/lib/mysql + fi + MYSQL_BINDIR=/usr/local/bin + elif test -f /usr/local/include/mysql.h; then + MYSQL_INCDIR=/usr/local/include + if test -f /usr/local/lib64/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/local/lib64 + else + MYSQL_LIBDIR=/usr/local/lib + fi + MYSQL_BINDIR=/usr/local/bin + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Unable to find mysql.h in standard locations) + fi else - if test -f $withval/include/mysql/mysql.h; then - MYSQL_INCDIR=$withval/include/mysql - if test -f $withval/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=$withval/lib64/mysql - else - MYSQL_LIBDIR=$withval/lib/mysql - fi - MYSQL_BINDIR=$withval/bin - elif test -f $withval/include/mysql.h; then - MYSQL_INCDIR=$withval/include - if test -f "$withval/lib64/libmysqlclient.a"; then - MYSQL_LIBDIR=$withval/lib64 - else - MYSQL_LIBDIR=$withval/lib - fi - MYSQL_BINDIR=$withval/bin - else - AC_MSG_RESULT(no) - AC_MSG_ERROR(Invalid MySQL directory $withval - unable to find mysql.h under $withval) - fi + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + if test -f $withval/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=$withval/lib64/mysql + else + MYSQL_LIBDIR=$withval/lib/mysql + # Solaris ... + if test -f $withval/lib/libmysqlclient.so; then + MYSQL_LIBDIR=$withval/lib + fi + fi + MYSQL_BINDIR=$withval/bin + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + if test -f "$withval/lib64/libmysqlclient.a"; then + MYSQL_LIBDIR=$withval/lib64 + else + MYSQL_LIBDIR=$withval/lib + fi + MYSQL_BINDIR=$withval/bin + else + AC_MSG_RESULT(no) + AC_MSG_ERROR(Invalid MySQL directory $withval - unable to find mysql.h under $withval) + fi fi SQL_INCLUDE=-I$MYSQL_INCDIR if test -f "$MYSQL_LIBDIR/libmysqlclient_r.a"; then diff --git a/bacula/configure b/bacula/configure index d032766b76..303519c3e4 100755 --- a/bacula/configure +++ b/bacula/configure @@ -16631,9 +16631,9 @@ echo "$as_me: error: Unable to find libpq-fe.h in standard locations" >&2;} elif test -f $withval/include/postgresql/libpq-fe.h; then POSTGRESQL_INCDIR=$withval/include/postgresql if test -d $withval/lib64; then - POSTGRESQL_LIBDIR=$withval/lib64 + POSTGRESQL_LIBDIR=$withval/lib64 else - POSTGRESQL_LIBDIR=$withval/lib + POSTGRESQL_LIBDIR=$withval/lib fi POSTGRESQL_BINDIR=$withval/bin else @@ -16848,80 +16848,84 @@ if test "${with_mysql+set}" = set; then if test "$withval" != "no"; then if test "$withval" = "yes"; then - if test -f /usr/local/mysql/include/mysql/mysql.h; then - MYSQL_INCDIR=/usr/local/mysql/include/mysql - if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql - else - MYSQL_LIBDIR=/usr/local/mysql/lib/mysql - fi - MYSQL_BINDIR=/usr/local/mysql/bin - elif test -f /usr/include/mysql/mysql.h; then - MYSQL_INCDIR=/usr/include/mysql - if test -f /usr/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/lib64/mysql - else - MYSQL_LIBDIR=/usr/lib/mysql - fi - MYSQL_BINDIR=/usr/bin - elif test -f /usr/include/mysql.h; then - MYSQL_INCDIR=/usr/include - if test -f /usr/lib64/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/lib64 - else - MYSQL_LIBDIR=/usr/lib - fi - MYSQL_BINDIR=/usr/bin - elif test -f /usr/local/include/mysql/mysql.h; then - MYSQL_INCDIR=/usr/local/include/mysql - if test -f /usr/local/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/local/lib64/mysql - else - MYSQL_LIBDIR=/usr/local/lib/mysql - fi - MYSQL_BINDIR=/usr/local/bin - elif test -f /usr/local/include/mysql.h; then - MYSQL_INCDIR=/usr/local/include - if test -f /usr/local/lib64/libmysqlclient.a; then - MYSQL_LIBDIR=/usr/local/lib64 - else - MYSQL_LIBDIR=/usr/local/lib - fi - MYSQL_BINDIR=/usr/local/bin - else - echo "$as_me:$LINENO: result: no" >&5 + if test -f /usr/local/mysql/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/mysql/include/mysql + if test -f /usr/local/mysql/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/local/mysql/lib64/mysql + else + MYSQL_LIBDIR=/usr/local/mysql/lib/mysql + fi + MYSQL_BINDIR=/usr/local/mysql/bin + elif test -f /usr/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/include/mysql + if test -f /usr/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/lib64/mysql + else + MYSQL_LIBDIR=/usr/lib/mysql + fi + MYSQL_BINDIR=/usr/bin + elif test -f /usr/include/mysql.h; then + MYSQL_INCDIR=/usr/include + if test -f /usr/lib64/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/lib64 + else + MYSQL_LIBDIR=/usr/lib + fi + MYSQL_BINDIR=/usr/bin + elif test -f /usr/local/include/mysql/mysql.h; then + MYSQL_INCDIR=/usr/local/include/mysql + if test -f /usr/local/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/local/lib64/mysql + else + MYSQL_LIBDIR=/usr/local/lib/mysql + fi + MYSQL_BINDIR=/usr/local/bin + elif test -f /usr/local/include/mysql.h; then + MYSQL_INCDIR=/usr/local/include + if test -f /usr/local/lib64/libmysqlclient.a; then + MYSQL_LIBDIR=/usr/local/lib64 + else + MYSQL_LIBDIR=/usr/local/lib + fi + MYSQL_BINDIR=/usr/local/bin + else + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - { { echo "$as_me:$LINENO: error: Unable to find mysql.h in standard locations" >&5 + { { echo "$as_me:$LINENO: error: Unable to find mysql.h in standard locations" >&5 echo "$as_me: error: Unable to find mysql.h in standard locations" >&2;} { (exit 1); exit 1; }; } - fi + fi else - if test -f $withval/include/mysql/mysql.h; then - MYSQL_INCDIR=$withval/include/mysql - if test -f $withval/lib64/mysql/libmysqlclient.a; then - MYSQL_LIBDIR=$withval/lib64/mysql - else - MYSQL_LIBDIR=$withval/lib/mysql - fi - MYSQL_BINDIR=$withval/bin - elif test -f $withval/include/mysql.h; then - MYSQL_INCDIR=$withval/include - if test -f "$withval/lib64/libmysqlclient.a"; then - MYSQL_LIBDIR=$withval/lib64 - else - MYSQL_LIBDIR=$withval/lib - fi - MYSQL_BINDIR=$withval/bin - else - echo "$as_me:$LINENO: result: no" >&5 + if test -f $withval/include/mysql/mysql.h; then + MYSQL_INCDIR=$withval/include/mysql + if test -f $withval/lib64/mysql/libmysqlclient.a; then + MYSQL_LIBDIR=$withval/lib64/mysql + else + MYSQL_LIBDIR=$withval/lib/mysql + # Solaris ... + if test -f $withval/lib/libmysqlclient.so; then + MYSQL_LIBDIR=$withval/lib + fi + fi + MYSQL_BINDIR=$withval/bin + elif test -f $withval/include/mysql.h; then + MYSQL_INCDIR=$withval/include + if test -f "$withval/lib64/libmysqlclient.a"; then + MYSQL_LIBDIR=$withval/lib64 + else + MYSQL_LIBDIR=$withval/lib + fi + MYSQL_BINDIR=$withval/bin + else + echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - { { echo "$as_me:$LINENO: error: Invalid MySQL directory $withval - unable to find mysql.h under $withval" >&5 + { { echo "$as_me:$LINENO: error: Invalid MySQL directory $withval - unable to find mysql.h under $withval" >&5 echo "$as_me: error: Invalid MySQL directory $withval - unable to find mysql.h under $withval" >&2;} { (exit 1); exit 1; }; } - fi + fi fi SQL_INCLUDE=-I$MYSQL_INCDIR - if test -f $MYSQL_LIBDIR/libmysqlclient_r.a; then + if test -f "$MYSQL_LIBDIR/libmysqlclient_r.a"; then SQL_LFLAGS="-L$MYSQL_LIBDIR -lmysqlclient_r -lz" cat >>confdefs.h <<\_ACEOF #define HAVE_THREAD_SAFE_MYSQL 1 diff --git a/bacula/scripts/mtx-changer.in b/bacula/scripts/mtx-changer.in index ddc04e85cd..4588ef0753 100644 --- a/bacula/scripts/mtx-changer.in +++ b/bacula/scripts/mtx-changer.in @@ -36,6 +36,24 @@ MTX=@MTX@ +# mt status output +# SunOS No Additional Sense +# FreeBSD Current Driver State: at rest. +# Linux ONLINE + +OS=`uname` +case ${OS} in + SunOS) + ready="No Additional Sense" + ;; + FreeBSD) + ready="Current Driver State: at rest." + ;; + *) + stat="ONLINE" + ;; +esac + # # log whats done # @@ -72,11 +90,13 @@ make_temp_file() { # Note, this is very system dependent, so if you are # not running on Linux, you will probably need to # re-write it, or at least change the grep target. +# We've attempted to get the appropriate OS grep targets +# in the code at the top of this script. # wait_for_drive() { i=0 while [ $i -le 300 ]; do # Wait max 300 seconds - if mt -f $1 status | grep ONLINE >/dev/null 2>&1; then + if mt -f $1 status | grep ${ready} >/dev/null 2>&1; then break fi debug "Device $1 - not ready, retrying..." diff --git a/bacula/src/cats/create_sqlite_database.in b/bacula/src/cats/create_sqlite_database.in index 3d7ba64644..5b3a6401e6 100644 --- a/bacula/src/cats/create_sqlite_database.in +++ b/bacula/src/cats/create_sqlite_database.in @@ -2,10 +2,5 @@ # # shell script to create Bacula SQLite tables -bindir=@SQL_BINDIR@ -cd @working_dir@ -sqlite=@DB_NAME@ - -${bindir}/${sqlite} $* bacula.db <fd = fopen(d->where, mode); + if (!d->fd) { + berrno be; + d->fd = stdout; + Qmsg2(jcr, M_ERROR, 0, _("fopen %s failed: ERR=%s\n"), d->where, + be.strerror()); + d->fd = NULL; + return false; + } + return true; +} /* * Handle sending the message to the appropriate place @@ -562,6 +574,7 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg) int len, dtlen; MSGS *msgs; BPIPE *bpipe; + char *mode; Dmsg2(850, "Enter dispatch_msg type=%d msg=%s", type, msg); @@ -693,37 +706,27 @@ void dispatch_message(JCR *jcr, int type, time_t mtime, char *msg) } fputs(msg, d->fd); break; + case MD_APPEND: + Dmsg1(850, "APPEND for following msg: %s", msg); + mode = "ab"; + goto send_to_file; case MD_FILE: Dmsg1(850, "FILE for following msg: %s", msg); - if (!d->fd) { - d->fd = fopen(d->where, "w+b"); - if (!d->fd) { - berrno be; - d->fd = stdout; - Qmsg2(jcr, M_ERROR, 0, _("fopen %s failed: ERR=%s\n"), d->where, - be.strerror()); - d->fd = NULL; - break; - } + mode = "w+b"; +send_to_file: + if (!d->fd && !open_dest_file(jcr, d, mode)) { + break; } fputs(dt, d->fd); fputs(msg, d->fd); - break; - case MD_APPEND: - Dmsg1(850, "APPEND for following msg: %s", msg); - if (!d->fd) { - d->fd = fopen(d->where, "ab"); - if (!d->fd) { - berrno be; - d->fd = stdout; - Qmsg2(jcr, M_ERROR, 0, _("fopen %s failed: ERR=%s\n"), d->where, - be.strerror()); - d->fd = NULL; - break; + /* On error, we close and reopen to handle log rotation */ + if (ferror(d->fd)) { + fclose(d->fd); + if (open_dest_file(jcr, d, mode)) { + fputs(dt, d->fd); + fputs(msg, d->fd); } } - fputs(dt, d->fd); - fputs(msg, d->fd); break; case MD_DIRECTOR: Dmsg1(850, "DIRECTOR for following msg: %s", msg); diff --git a/bacula/src/stored/autochanger.c b/bacula/src/stored/autochanger.c index a58ccd729c..83adf6ad01 100644 --- a/bacula/src/stored/autochanger.c +++ b/bacula/src/stored/autochanger.c @@ -164,8 +164,7 @@ int autoload_device(DCR *dcr, int writing, BSOCK *dir) _("3304 Issuing autochanger \"load slot %d, drive %d\" command.\n"), slot, drive); dcr->VolCatInfo.Slot = slot; /* slot to be loaded */ - changer = edit_device_codes(dcr, changer, - dcr->device->changer_command, "load"); + changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "load"); dev->close(); Dmsg1(200, "Run program=%s\n", changer); status = run_program(changer, timeout, NULL); @@ -214,10 +213,11 @@ int get_autochanger_loaded_slot(DCR *dcr) { JCR *jcr = dcr->jcr; DEVICE *dev = dcr->dev; - POOLMEM *changer, *results; int status, loaded; uint32_t timeout = dcr->device->max_changer_wait; int drive = dcr->dev->drive_index; + POOL_MEM results(PM_MESSAGE); + POOLMEM *changer; if (!dev->is_autochanger()) { return -1; @@ -230,21 +230,18 @@ int get_autochanger_loaded_slot(DCR *dcr) return dev->Slot; } - results = get_pool_memory(PM_MESSAGE); - changer = get_pool_memory(PM_FNAME); - - /* Find out what is loaded, zero means device is unloaded */ + changer = get_pool_memory(PM_FNAME); lock_changer(dcr); Jmsg(jcr, M_INFO, 0, _("3301 Issuing autochanger \"loaded? drive %d\" command.\n"), drive); changer = edit_device_codes(dcr, changer, dcr->device->changer_command, "loaded"); - *results = 0; + *results.c_str() = 0; Dmsg1(100, "Run program=%s\n", changer); - status = run_program(changer, timeout, results); - Dmsg3(100, "run_prog: %s stat=%d result=%s\n", changer, status, results); + status = run_program_full_output(changer, timeout, results.c_str()); + Dmsg3(100, "run_prog: %s stat=%d result=%s\n", changer, status, results.c_str()); if (status == 0) { - loaded = str_to_int32(results); + loaded = str_to_int32(results.c_str()); if (loaded > 0) { Jmsg(jcr, M_INFO, 0, _("3302 Autochanger \"loaded? drive %d\", result is Slot %d.\n"), drive, loaded); @@ -257,13 +254,12 @@ int get_autochanger_loaded_slot(DCR *dcr) } else { berrno be; be.set_errno(status); - Jmsg(jcr, M_INFO, 0, _("3991 Bad autochanger \"loaded? drive %d\" command: ERR=%s.\n"), - drive, be.strerror()); + Jmsg(jcr, M_INFO, 0, _("3991 Bad autochanger \"loaded? drive %d\" command: " + "ERR=%s.\nResults=%s\n"), drive, be.strerror(), results.c_str()); loaded = -1; /* force unload */ } unlock_changer(dcr); free_pool_memory(changer); - free_pool_memory(results); return loaded; } @@ -313,6 +309,7 @@ bool unload_autochanger(DCR *dcr, int loaded) } if (loaded > 0) { + POOL_MEM results(PM_MESSAGE); POOLMEM *changer = get_pool_memory(PM_FNAME); lock_changer(dcr); Jmsg(jcr, M_INFO, 0, @@ -324,13 +321,15 @@ bool unload_autochanger(DCR *dcr, int loaded) dcr->device->changer_command, "unload"); dev->close(); Dmsg1(100, "Run program=%s\n", changer); - int stat = run_program(changer, timeout, NULL); + *results.c_str() = 0; + int stat = run_program_full_output(changer, timeout, results.c_str()); dcr->VolCatInfo.Slot = slot; if (stat != 0) { berrno be; be.set_errno(stat); - Jmsg(jcr, M_INFO, 0, _("3995 Bad autochanger \"unload slot %d, drive %d\": ERR=%s.\n"), - slot, dev->drive_index, be.strerror()); + Jmsg(jcr, M_INFO, 0, _("3995 Bad autochanger \"unload slot %d, drive %d\": " + "ERR=%s\nResults=%s\n"), + loaded, dev->drive_index, be.strerror(), results.c_str()); ok = false; dev->Slot = -1; /* unknown */ } else { diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index d3ad48148b..cf1f065730 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -2779,10 +2779,10 @@ static bool my_mount_next_read_volume(DCR *dcr) } free_restore_volume_list(jcr); + dev->close(); set_volume_name("TestVolume2", 2); jcr->bsr = NULL; create_restore_volume_list(jcr); - dev->close(); if (!acquire_device_for_read(dcr)) { Pmsg2(0, _("Cannot open Dev=%s, Vol=%s\n"), dev->print_name(), dcr->VolumeName); return false; diff --git a/bacula/src/tray-monitor/tray_conf.c b/bacula/src/tray-monitor/tray_conf.c index 0f38ff93f5..313825ec4d 100644 --- a/bacula/src/tray-monitor/tray_conf.c +++ b/bacula/src/tray-monitor/tray_conf.c @@ -22,24 +22,19 @@ * Version $Id$ */ /* - Copyright (C) 2004 Kern Sibbald and John Walker + Copyright (C) 2004-2006 Kern Sibbald This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of - the License, or (at your option) any later version. + modify it under the terms of the GNU General Public License + version 2 as amended with additional clauses defined in the + file LICENSE in the main source directory. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + the file LICENSE for additional details. - You should have received a copy of the GNU General Public - License along with this program; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA. - -*/ + */ #include "bacula.h" #include "tray_conf.h" diff --git a/bacula/src/version.h b/bacula/src/version.h index cff8f42f2c..502170bc04 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -3,9 +3,9 @@ */ #undef VERSION -#define VERSION "1.39.24" -#define BDATE "02 October 2006" -#define LSMDATE "02Oct06" +#define VERSION "1.39.25" +#define BDATE "07 October 2006" +#define LSMDATE "07Oct06" #define BYEAR "2006" /* year for copyright messages in progs */ /* Debug flags */ diff --git a/bacula/src/win32/filed/vss.cpp b/bacula/src/win32/filed/vss.cpp index b3d1fa7e36..e66d34d547 100644 --- a/bacula/src/win32/filed/vss.cpp +++ b/bacula/src/win32/filed/vss.cpp @@ -131,13 +131,13 @@ BOOL VSSClient::GetShadowPath(const char *szFilePath, char *szShadowPath, int nB if (WideCharToMultiByte(CP_UTF8,0,m_szShadowCopyName[nDriveIndex],-1,szShadowPath,nBuflen-1,NULL,NULL)) { nBuflen -= (int)strlen(szShadowPath); - strncat(szShadowPath, szFilePath+2, nBuflen); + bstrncat(szShadowPath, szFilePath+2, nBuflen); return TRUE; } } } - strncpy(szShadowPath, szFilePath, nBuflen); + bstrncpy(szShadowPath, szFilePath, nBuflen); errno = EINVAL; return FALSE; } @@ -166,7 +166,7 @@ BOOL VSSClient::GetShadowPathW(const wchar_t *szFilePath, wchar_t *szShadowPath, } } - wcsncpy(szShadowPath, szFilePath, nBuflen); + wcsncpy(szShadowPath, szFilePath, nBuflen); errno = EINVAL; return FALSE; } @@ -174,21 +174,21 @@ BOOL VSSClient::GetShadowPathW(const wchar_t *szFilePath, wchar_t *szShadowPath, const size_t VSSClient::GetWriterCount() { - alist* pV = (alist*) m_pAlistWriterInfoText; + alist* pV = (alist*)m_pAlistWriterInfoText; return pV->size(); } const char* VSSClient::GetWriterInfo(int nIndex) { - alist* pV = (alist*) m_pAlistWriterInfoText; - return (char*) pV->get(nIndex); + alist* pV = (alist*)m_pAlistWriterInfoText; + return (char*)pV->get(nIndex); } const int VSSClient::GetWriterState(int nIndex) { - alist* pV = (alist*) m_pAlistWriterState; - return (int) pV->get(nIndex); + alist* pV = (alist*)m_pAlistWriterState; + return (int)pV->get(nIndex); } void VSSClient::AppendWriterInfo(int nState, const char* pszInfo) @@ -196,17 +196,17 @@ void VSSClient::AppendWriterInfo(int nState, const char* pszInfo) alist* pT = (alist*) m_pAlistWriterInfoText; alist* pS = (alist*) m_pAlistWriterState; - pT->push (bstrdup(pszInfo)); - pS->push ((void*) nState); + pT->push(bstrdup(pszInfo)); + pS->push((void*)nState); } void VSSClient::DestroyWriterInfo() { - alist* pT = (alist*) m_pAlistWriterInfoText; - alist* pS = (alist*) m_pAlistWriterState; + alist* pT = (alist*)m_pAlistWriterInfoText; + alist* pS = (alist*)m_pAlistWriterState; while (!pT->empty()) - free (pT->pop()); + free(pT->pop()); while (!pS->empty()) pS->pop(); diff --git a/bacula/src/win32/filed/vss_generic.cpp b/bacula/src/win32/filed/vss_generic.cpp index 4d60b8bec8..2d48141a9f 100644 --- a/bacula/src/win32/filed/vss_generic.cpp +++ b/bacula/src/win32/filed/vss_generic.cpp @@ -381,16 +381,16 @@ BOOL VSSClientGeneric::CreateSnapshots(char* szDriveLetters) szDrive[0] = szDriveLetters[i]; volume = GetUniqueVolumeNameForPath(szDrive); // store uniquevolumname - if (SUCCEEDED(pVss->AddToSnapshotSet((LPWSTR)volume.c_str(), GUID_NULL, &pid))) + if (SUCCEEDED(pVss->AddToSnapshotSet((LPWSTR)volume.c_str(), GUID_NULL, &pid))) { wcsncpy (m_wszUniqueVolumeName[szDriveLetters[i]-'A'], (LPWSTR) volume.c_str(), MAX_PATH); - else - { + } else { szDriveLetters[i] = tolower (szDriveLetters[i]); } } /* PrepareForBackup */ if (FAILED(pVss->PrepareForBackup(&pAsync1.p))) { + errno = b_errno_win32; return FALSE; } @@ -399,11 +399,13 @@ BOOL VSSClientGeneric::CreateSnapshots(char* szDriveLetters) /* get latest info about writer status */ if (!CheckWriterStatus()) { + errno = b_errno_win32; return FALSE; } /* DoSnapShotSet */ if (FAILED(pVss->DoSnapshotSet(&pAsync2.p))) { + errno = b_errno_win32; return FALSE; } @@ -605,16 +607,16 @@ BOOL VSSClientGeneric::CheckWriterStatus() /* store text info */ char str[1000]; char szBuf[200]; - strcpy(str, "\""); + bstrncpy(str, "\"", sizeof(str)); wchar_2_UTF8(szBuf, bstrWriterName.p, sizeof(szBuf)); - strcat(str, szBuf); - strcat(str, "\", State: 0x"); + bstrncat(str, szBuf, sizeof(str)); + bstrncat(str, "\", State: 0x"); itoa(eWriterStatus, szBuf, sizeof(szBuf)); - strcat(str, szBuf); - strcat(str, " ("); + bstrncat(str, szBuf, sizeof(str)); + bstrncat(str, " (", sizeof(str)); wchar_2_UTF8(szBuf, GetStringFromWriterStatus(eWriterStatus), sizeof(szBuf)); - strcat(str, szBuf); - strcat(str, ")"); + bstrncat(str, szBuf, sizeof(str)); + bstrncat(str, ")", sizeof(str)); AppendWriterInfo(nState, (const char *)str); } diff --git a/bacula/technotes-1.39 b/bacula/technotes-1.39 index b95a871daa..70fc1ef297 100644 --- a/bacula/technotes-1.39 +++ b/bacula/technotes-1.39 @@ -1,13 +1,31 @@ Technical notes on version 1.39 General: +07Oct06 +kes Begin work on new GUI "console". +kes Make configure look in non-standard MySQL library directory + for Solaris. +kes Make mtx-changer automatically configure the autochanger wait + procedure for Solaris, FreeBSD, and Linux. Previously, only Linux + was implemented. +kes Correct drop_sqlite_tables.in script to not delete the database. +kes When writing to a log file, close and reopen the file descriptor + if there is an error writing the file. +kes Modify the autochanger loaded?, load, and unload commands to print + the full text of any mtx output if there is an error. Helps to + ease diagnosis of autochanger problems. +kes Correct a few Win32 errno returns in the VSS code so that hopefully + a resonable Win32 error message will be printed. +kes Convert a few strcat()... to bstrncat() in the Win32 code. + +Version 1.39.24 released: 02Oct06 kes Apply dvd find volume patch from Richard Mortimer. kes Eliminate the dvd specific mount routines using only the dev->mount/unmount. kes Make update_free_space a method of DEVICE and rename update_freespace. -01Sep06 +01Oct06 kes Require a messages command acl to be able to receive messages in a console. kes Add console, system, and scan job types in util.c. -- 2.39.5