Skip to content

Commit

Permalink
Fix problem with new DCR constructor.
Browse files Browse the repository at this point in the history
Coverity found a valid problem with the new DCR constructor that cannot
use the dev variable as that is a non initialized variable in the
constructor so use a proper local error buffer.
  • Loading branch information
Marco van Wieringen committed Feb 17, 2015
1 parent 1390c55 commit 37218b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/stored/acquire.c
Expand Up @@ -636,23 +636,23 @@ bool clean_device(DCR *dcr)
*/
DCR::DCR()
{
POOL_MEM errmsg(PM_MESSAGE);
int errstat;

tid = pthread_self();
spool_fd = -1;
if ((errstat = pthread_mutex_init(&m_mutex, NULL)) != 0) {
berrno be;

dev->dev_errno = errstat;
Mmsg1(dev->errmsg, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(errstat));
Jmsg0(jcr, M_ERROR_TERM, 0, dev->errmsg);
Mmsg(errmsg, _("Unable to init mutex: ERR=%s\n"), be.bstrerror(errstat));
Jmsg0(jcr, M_ERROR_TERM, 0, errmsg.c_str());
}

if ((errstat = pthread_mutex_init(&r_mutex, NULL)) != 0) {
berrno be;

dev->dev_errno = errstat;
Mmsg1(dev->errmsg, _("Unable to init r_mutex: ERR=%s\n"), be.bstrerror(errstat));
Jmsg0(jcr, M_ERROR_TERM, 0, dev->errmsg);
Mmsg(errmsg, _("Unable to init r_mutex: ERR=%s\n"), be.bstrerror(errstat));
Jmsg0(jcr, M_ERROR_TERM, 0, errmsg.c_str());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/stored/askdir.c
Expand Up @@ -598,7 +598,7 @@ bool SD_DCR::dir_ask_sysop_to_mount_volume(int mode)
return false;
}
ASSERT(dev->blocked());
for ( ;; ) {
while (1) {
if (job_canceled(jcr)) {
Mmsg(dev->errmsg, _("Job %s canceled while waiting for mount on Storage Device %s.\n"),
jcr->Job, dev->print_name());
Expand Down

0 comments on commit 37218b8

Please sign in to comment.