From aa410343a016f93eec1218935ce7dcc50c0f659b Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Thu, 10 Feb 2005 13:42:10 +0000 Subject: [PATCH] Ensure that correct error messages are returned when reading an ANSI label. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1821 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/ansi_label.c | 11 ++++++++++- bacula/src/version.h | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/bacula/src/stored/ansi_label.c b/bacula/src/stored/ansi_label.c index 0ee7ad0f8a..85fb30538d 100644 --- a/bacula/src/stored/ansi_label.c +++ b/bacula/src/stored/ansi_label.c @@ -80,7 +80,7 @@ int read_ansi_ibm_label(DCR *dcr) berrno be; clrerror_dev(dev, -1); Dmsg1(000, "Read device got: ERR=%s\n", be.strerror()); - Mmsg2(dev->errmsg, _("Read error on device %s in ANSI/IBM label. ERR=%s\n"), + Mmsg2(jcr->errmsg, _("Read error on device %s in ANSI label. ERR=%s\n"), dev->dev_name, be.strerror()); Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); dev->VolCatInfo.VolCatErrors++; @@ -90,6 +90,7 @@ int read_ansi_ibm_label(DCR *dcr) if (dev->at_eof()) { dev->state |= ST_EOT; Dmsg0(000, "EOM on ANSI label\n"); + Mmsg0(jcr->errmsg, _("Insane! End of tape while reading ANSI label.\n")); return VOL_LABEL_ERROR; /* at EOM this shouldn't happen */ } else { dev->set_eof(); @@ -99,6 +100,7 @@ int read_ansi_ibm_label(DCR *dcr) case 0: /* Want VOL1 label */ if (stat != 80 || strncmp("VOL1", label, 4) != 0) { Dmsg0(000, "No VOL1 label\n"); + Mmsg0(jcr->errmsg, _("No VOL1 label while reading ANSI label.\n")); return VOL_NO_LABEL; /* No ANSI label */ } @@ -114,6 +116,7 @@ int read_ansi_ibm_label(DCR *dcr) } *q = 0; Dmsg2(000, "Wanted ANSI Vol %s got %6s\n", VolName, dev->VolHdr.VolName); + Mmsg2(jcr->errmsg, "Wanted ANSI Volume \"%s\" got \"%s\"\n", VolName, dev->VolHdr.VolName); return VOL_NAME_ERROR; } } @@ -121,17 +124,21 @@ int read_ansi_ibm_label(DCR *dcr) case 1: if (stat != 80 || strncmp("HDR1", label, 4) != 0) { Dmsg0(000, "No HDR1 label\n"); + Mmsg0(jcr->errmsg, _("No HDR1 label while reading ANSI label.\n")); return VOL_LABEL_ERROR; } if (strncmp("BACULA.DATA", &label[4], 11) != 0) { Dmsg1(000, "HD1 not Bacula label. Wanted BACULA.DATA got %11s\n", &label[4]); + Mmsg1(jcr->errmsg, _("ANSI Volume \"%s\" does not belong to Bacula.\n"), + dev->VolHdr.VolName); return VOL_NAME_ERROR; /* Not a Bacula label */ } break; case 2: if (stat != 80 || strncmp("HDR2", label, 4) != 0) { Dmsg0(000, "No HDR2 label\n"); + Mmsg0(jcr->errmsg, _("No HDR2 label while reading ANSI label.\n")); return VOL_LABEL_ERROR; } break; @@ -142,12 +149,14 @@ int read_ansi_ibm_label(DCR *dcr) } if (stat != 80 || strncmp("HDR", label, 3) != 0) { Dmsg0(000, "Unknown or bad ANSI label record.\n"); + Mmsg0(jcr->errmsg, _("Unknown or bad ANSI label record.\n")); return VOL_LABEL_ERROR; } break; } } Dmsg0(000, "Too many records in ANSI label.\n"); + Mmsg0(jcr->errmsg, _("Too many records in while reading ANSI label.\n")); return VOL_LABEL_ERROR; } diff --git a/bacula/src/version.h b/bacula/src/version.h index bbde218477..638e86f7df 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #undef VERSION #define VERSION "1.37.3" -#define BDATE "09 February 2005" -#define LSMDATE "09Feb05" +#define BDATE "10 February 2005" +#define LSMDATE "10Feb05" /* Debug flags */ #undef DEBUG -- 2.39.5