From: Kern Sibbald Date: Sun, 25 May 2008 13:16:26 +0000 (+0000) Subject: Fix a few more Coverity reported problems. X-Git-Tag: Release-2.4.0~25 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=96427e5d99a0d39ef9f2fd323a6a7d4d239c827c;p=bacula%2Fbacula Fix a few more Coverity reported problems. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/branches/Branch-2.2@7031 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/ReleaseNotes b/bacula/ReleaseNotes index a45a9b3346..80b3e19245 100644 --- a/bacula/ReleaseNotes +++ b/bacula/ReleaseNotes @@ -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 diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index f4bcc5cc0d..3596291b5d 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -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; } diff --git a/bacula/src/lib/smartall.c b/bacula/src/lib/smartall.c index 73e4b8230d..862cce5471 100644 --- a/bacula/src/lib/smartall.c +++ b/bacula/src/lib/smartall.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. @@ -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; } diff --git a/bacula/src/stored/match_bsr.c b/bacula/src/stored/match_bsr.c index e8dbdc2fdd..2552eee607 100644 --- a/bacula/src/stored/match_bsr.c +++ b/bacula/src/stored/match_bsr.c @@ -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; diff --git a/bacula/src/version.h b/bacula/src/version.h index 32f188bdec..90720e3396 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -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 */ diff --git a/bacula/technotes-2.1 b/bacula/technotes-2.1 index c9304d218d..c64c474be3 100644 --- a/bacula/technotes-2.1 +++ b/bacula/technotes-2.1 @@ -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.