]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Begin work on new GUI console.
authorKern Sibbald <kern@sibbald.com>
Sat, 7 Oct 2006 21:09:43 +0000 (21:09 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 7 Oct 2006 21:09:43 +0000 (21:09 +0000)
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
bacula/configure
bacula/scripts/mtx-changer.in
bacula/src/cats/create_sqlite_database.in
bacula/src/cats/drop_sqlite_tables.in
bacula/src/lib/message.c
bacula/src/stored/autochanger.c
bacula/src/stored/btape.c
bacula/src/version.h
bacula/technotes-1.39

index a5238bae699a23d39840805309d79107775ccde7..e70564f0ab68a3d644ee7ac57bf9a7adf24e3a88 100644 (file)
@@ -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
index d032766b76c849a5fcab73783cd24e783749f935..303519c3e44e7b2a546a79b701df63c2a87097d5 100755 (executable)
@@ -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
index ddc04e85cd19896632a0110cdd5d74a74a077fd3..4588ef0753e121658e19082155a6488fc60cd993 100644 (file)
 
 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..."
index 3d7ba64644ef2f4be479442b1f7d6cbee13856e2..5b3a6401e6b73442f086b1d70b75bcd999fb3d9c 100644 (file)
@@ -2,10 +2,5 @@
 #
 # shell script to create Bacula SQLite tables
 
-bindir=@SQL_BINDIR@
-cd @working_dir@
-sqlite=@DB_NAME@
-
-${bindir}/${sqlite} $* bacula.db <<END-OF-DATA
-END-OF-DATA
+touch @working_dir@/bacula.db
 exit 0
index 1365db6f5d81a67f733adab1721069327dd68f96..87fe38fdaf9b5053945907db1b398581c85953b1 100644 (file)
@@ -1,7 +1,8 @@
 #!/bin/sh
 #
-# shell script to Delete the SQLite Bacula database (same as deleting 
-#  the tables)
+# shell script to Delete the SQLite tables, we simply delete and recreate
+#  the database.
 #
 
 rm -f @working_dir@/bacula.db
+touch @working_dir@/bacula.db
index 6e131e55edb1d1777096c114c5d1ffa8928c80bd..9e9d219e1bf1ffdb85bab17e74d38bf44a0f20ef 100755 (executable)
@@ -47,7 +47,7 @@ char con_fname[500];                  /* Console filename */
 FILE *con_fd = NULL;                  /* Console file descriptor */
 brwlock_t con_lock;                   /* Console lock structure */
 
-static char *catalog_db = NULL;              /* database type */
+static char *catalog_db = NULL;       /* database type */
 
 const char *host_os = HOST_OS;
 const char *distname = DISTNAME;
@@ -549,7 +549,19 @@ void term_msg()
    term_last_jobs_list();
 }
 
-
+static bool open_dest_file(JCR *jcr, DEST *d, const char *mode) 
+{
+   d->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);
index a58ccd729cd49679152bac57392c8ce5ac1ad23c..83adf6ad01c733831daf0085c0ec4b588c7aaedb 100644 (file)
@@ -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 {
index d3ad48148b5c76afcb93c44fdd36ceba01e9fcee..cf1f065730a1b8120994608c434400c19757712b 100644 (file)
@@ -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;
index cff8f42f2c7ffc9a77a38bef413044374114112d..502170bc0475911c97a035a6295fad6332df5e0a 100644 (file)
@@ -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 */
index b95a871daae48815929f2723074c1ae826ad8374..70fc1ef297671b665155605812bf4f64c5303c7c 100644 (file)
@@ -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.