From: Kern Sibbald Date: Fri, 11 Dec 2015 08:51:18 +0000 (+0100) Subject: Fix some low level messages to display correctly X-Git-Tag: Release-7.4.0~152 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=166e1b9146fb98c2f93703f5cea8d7a02f9ad166;p=bacula%2Fbacula Fix some low level messages to display correctly --- diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index dee3a03610..1a2e933e7a 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -680,7 +680,7 @@ static void label_volume_if_ok(DCR *dcr, char *oldname, case VOL_NO_LABEL: if (!write_new_volume_label_to_dev(dcr, newname, poolname, relabel, true /* write dvd now */)) { - dir->fsend(_("3912 Failed to label Volume: ERR=%s\n"), dev->bstrerror()); + dir->fsend(_("3912 Failed to label Volume: ERR=%s\n"), dcr->jcr->errmsg); break; } bstrncpy(dcr->VolumeName, newname, sizeof(dcr->VolumeName)); @@ -696,10 +696,10 @@ static void label_volume_if_ok(DCR *dcr, char *oldname, type, newname, dev->print_name()); break; case VOL_TYPE_ERROR: - dir->fsend(_("3915 Failed to label Volume: ERR=%s\n"), dev->errmsg); + dir->fsend(_("3912 Failed to label Volume: ERR=%s\n"), dcr->jcr->errmsg); break; case VOL_NO_MEDIA: - dir->fsend(_("3914 Failed to label Volume (no media): ERR=%s\n"), dev->bstrerror()); + dir->fsend(_("3914 Failed to label Volume (no media): ERR=%s\n"), dcr->jcr->errmsg); break; default: dir->fsend(_("3913 Cannot label Volume. " diff --git a/bacula/src/stored/file_dev.c b/bacula/src/stored/file_dev.c index d7166e7f79..09cee358f2 100644 --- a/bacula/src/stored/file_dev.c +++ b/bacula/src/stored/file_dev.c @@ -155,6 +155,9 @@ void DEVICE::open_file_device(DCR *dcr, int omode) if (VolCatInfo.VolCatName[0] == 0) { Mmsg(errmsg, _("Could not open file device %s. No Volume name given.\n"), print_name()); + if (dcr->jcr) { + pm_strcpy(dcr->jcr->errmsg, errmsg); + } clear_opened(); return; } @@ -194,6 +197,10 @@ void DEVICE::open_file_device(DCR *dcr, int omode) if (fstat(m_fd, &sp) == 0) { devno = sp.st_dev; } + } else { + if (dcr->jcr) { + pm_strcpy(dcr->jcr->errmsg, errmsg); + } } Dmsg1(100, "open dev: disk fd=%d opened\n", m_fd); } diff --git a/bacula/src/stored/label.c b/bacula/src/stored/label.c index cbab189a31..aaa97d78a3 100644 --- a/bacula/src/stored/label.c +++ b/bacula/src/stored/label.c @@ -236,7 +236,7 @@ int read_dev_volume_label(DCR *dcr) Mmsg3(jcr->errmsg, _("Could not reserve volume %s on %s device %s\n"), dev->VolHdr.VolumeName, dev->print_type(), dev->print_name()); } - Dmsg2(150, "Could not reserve volume %s on %s\n", dev->VolHdr.VolumeName, dev->print_name()); + Dmsg2(100, "Could not reserve volume %s on %s\n", dev->VolHdr.VolumeName, dev->print_name()); stat = VOL_NAME_ERROR; goto bail_out; } @@ -338,6 +338,9 @@ bool write_new_volume_label_to_dev(DCR *dcr, const char *VolName, Dmsg0(150, "write_volume_label()\n"); if (*VolName == 0) { + if (dcr->jcr) { + Mmsg(dcr->jcr->errmsg, "ERROR: new_volume_label_to_dev called with NULL VolName\n"); + } Pmsg0(0, "=== ERROR: write_new_volume_label_to_dev called with NULL VolName\n"); goto bail_out; } diff --git a/bacula/src/stored/tape_dev.c b/bacula/src/stored/tape_dev.c index 0119ee028e..4afdd8b747 100644 --- a/bacula/src/stored/tape_dev.c +++ b/bacula/src/stored/tape_dev.c @@ -163,6 +163,9 @@ void DEVICE::open_tape_device(DCR *dcr, int omode) berrno be; Mmsg2(errmsg, _("Unable to open device %s: ERR=%s\n"), print_name(), be.bstrerror(dev_errno)); + if (dcr->jcr) { + pm_strcpy(dcr->jcr->errmsg, errmsg); + } Dmsg1(100, "%s", errmsg); }