]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix a few more Coverity reported problems.
authorKern Sibbald <kern@sibbald.com>
Sun, 25 May 2008 13:16:26 +0000 (13:16 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 25 May 2008 13:16:26 +0000 (13:16 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@7031 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/ReleaseNotes
bacula/src/lib/message.c
bacula/src/lib/smartall.c
bacula/src/stored/match_bsr.c
bacula/src/version.h
bacula/technotes-2.1

index a45a9b33469859b6dbaee23cb28dbe06c690f3b0..80b3e1924540b778b70faf2068953d9097dd89be 100644 (file)
@@ -10,7 +10,7 @@ use some of the new features that affect the FD.  In other words, you should
 not have to upgrade all your File daemons when you upgrade. There is
 no database upgrade needed from version 2.0.x to 2.2.0.
 
-================   Warning !!!!!! ==========================
+==================   Warning !!!!!! ==========================
 As of Version 2.2.10-b4, the Win32 FD should not descend into 
 any reparse point directory or reparse mount points unless the  
 specified directory is explicitly mentioned at the top level of      
@@ -18,6 +18,7 @@ FileSet (as with Unix). A file that is linked to another file will
 be backed up, much like Unix hardlinked files.  If you want 
 reparse directories backed up, you must explicitly include them
 in your FileSet.
+==============================================================
 
 Beta Release Version 2.2.10-b4
 24May08
index f4bcc5cc0d19a12865fbf63232f746dbf720368d..3596291b5dc1c8ef013c72d16e11a00d7fec47ed 100644 (file)
@@ -388,17 +388,16 @@ static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM *&cmd, DEST *d)
    }
    fflush(stdout);
 
-   if (!(bpipe = open_bpipe(cmd, 120, "rw"))) {
+   if ((bpipe = open_bpipe(cmd, 120, "rw"))) {
+      /* If we had to use sendmail, add subject */
+      if (!d->mail_cmd) {
+         fprintf(bpipe->wfd, "Subject: %s\r\n\r\n", _("Bacula Message"));
+      }
+   } else {
       berrno be;
       Jmsg(jcr, M_ERROR, 0, _("open mail pipe %s failed: ERR=%s\n"),
          cmd, be.bstrerror());
    }
-
-   /* If we had to use sendmail, add subject */
-   if (!d->mail_cmd) {
-       fprintf(bpipe->wfd, "Subject: %s\r\n\r\n", _("Bacula Message"));
-   }
-
    return bpipe;
 }
 
index 73e4b8230d77ca0a633abd41f1f2e264e11d008c..862cce5471c8f27a32b7aa2aaa0f477fd1d6a1f2 100644 (file)
@@ -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.
@@ -451,18 +451,21 @@ int sm_check_rtn(const char *fname, int lineno, bool bufdump)
 
    P(mutex);
    ap = (struct abufhead *) abqueue.qnext;
-   while (ap != (struct abufhead *) &abqueue) {
+   while (ap != (struct abufhead *)&abqueue) {
       bad = 0;
-      if ((ap == NULL) ||
-          (ap->abq.qnext->qprev != (struct b_queue *) ap)) {
-         bad = 0x1;
-      }
-      if (ap->abq.qprev->qnext != (struct b_queue *) ap) {
-         bad |= 0x2;
-      }
-      if (((unsigned char *) ap)[((struct abufhead *) ap)->ablen - 1] !=
-           ((((long) ap) & 0xFF) ^ 0xC5)) {
-         bad |= 0x4;
+      if (ap != NULL) {
+         if (ap->abq.qnext->qprev != (struct b_queue *)ap) {
+            bad = 0x1;
+         }
+         if (ap->abq.qprev->qnext != (struct b_queue *)ap) {
+            bad |= 0x2;
+         }
+         if (((unsigned char *) ap)[((struct abufhead *)ap)->ablen - 1] !=
+              ((((long) ap) & 0xFF) ^ 0xC5)) {
+            bad |= 0x4;
+         }
+      } else {
+         bad = 0x8;
       }
       badbuf |= bad;
       if (bad) {
@@ -478,7 +481,13 @@ int sm_check_rtn(const char *fname, int lineno, bool bufdump)
          if (bad & 0x4) {
             fprintf(stderr, _("  discovery of data overrun.\n"));
          }
+         if (bad & 0x8) {
+            fprintf(stderr, _("  NULL pointer.\n"));
+         }
 
+         if (!ap) {
+            goto get_out;
+         }
          fprintf(stderr, _("  Buffer address: %p\n"), ap);
 
          if (ap->abfname != NULL) {
@@ -515,8 +524,9 @@ int sm_check_rtn(const char *fname, int lineno, bool bufdump)
             }
          }
       }
-      ap = (struct abufhead *) ap->abq.qnext;
+      ap = (struct abufhead *)ap->abq.qnext;
    }
+get_out:
    V(mutex);
    return badbuf ? 0 : 1;
 }
index e8dbdc2fdd2e33616801bfe89a144f17ddb0265c..2552eee607b3ae424282c1e445c59eeea7036d43 100644 (file)
@@ -193,7 +193,11 @@ BSR *find_next_bsr(BSR *root_bsr, DEVICE *dev)
    BSR *found_bsr = NULL;
 
    /* Do tape/disk seeking only if CAP_POSITIONBLOCKS is on */
-   if (!root_bsr || !root_bsr->use_positioning ||
+   if (!root_bsr) {
+      Dmsg0(dbglevel, "NULL root bsr pointer passed to find_next_bsr.\n");
+      return NULL;
+   }
+   if (!root_bsr->use_positioning ||
        !root_bsr->reposition || !dev->has_cap(CAP_POSITIONBLOCKS)) {
       Dmsg2(dbglevel, "No nxt_bsr use_pos=%d repos=%d\n", root_bsr->use_positioning, root_bsr->reposition);
       return NULL;
index 32f188bdec06d30c987aa07b25637d73f455021d..90720e339643d0629561d54cf1011ea4e0640dac 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "2.2.10-b4"
-#define BDATE   "24 May 2008"
-#define LSMDATE "24May08"
+#define BDATE   "25 May 2008"
+#define LSMDATE "25May08"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
index c9304d218dff01eb11347f197b935a13b19b23e5..c64c474be3447609302cae09811c40417903c89d 100644 (file)
@@ -1,7 +1,10 @@
               Technical notes on version 2.2
 
 General:
+25May08
+kes  Fix a few more Coverity reported problems.
 
+Beta Release Version 2.2.10-b4
 24May08
 kes  Enhance a couple of SD debug messages.
 kes  Tweak unload flag setting and ensure it is set during swap.