/*
Bacula® - The Network Backup Solution
- Copyright (C) 2001-2008 Free Software Foundation Europe e.V.
+ Copyright (C) 2001-2010 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.
This program is Free Software; you can redistribute it and/or
- modify it under the terms of version two of the GNU General Public
+ modify it under the terms of version three of the GNU Affero General Public
License as published by the Free Software Foundation and included
in the file LICENSE.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Affero General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
* Basic tasks done here:
* Handle Catalog services.
*
- * Version $Id$
*/
#include "bacula.h"
int index, ok, label, writing;
POOLMEM *omsg;
POOL_DBR pr;
- uint32_t Stripe;
+ uint32_t Stripe, Copy;
uint64_t MediaId;
utime_t VolFirstWritten;
utime_t VolLastWritten;
* the number of VolWrites has increased.
*/
if (jcr->wstore && jcr->wstore->StorageId && sdmr.VolWrites > mr.VolWrites) {
- mr.StorageId = jcr->wstore->StorageId;
+ Dmsg2(050, "Update StorageId old=%d new=%d\n",
+ mr.StorageId, jcr->wstore->StorageId);
+ if (jcr->wstore->StorageId == 0) {
+ Jmsg(jcr, M_ERROR, 0, _("Attempt to set StorageId to zero.\n"));
+ } else {
+ mr.StorageId = jcr->wstore->StorageId;
+ }
}
/* Copy updated values to original media record */
*/
} else if (sscanf(bs->msg, Create_job_media, &Job,
&jm.FirstIndex, &jm.LastIndex, &jm.StartFile, &jm.EndFile,
- &jm.StartBlock, &jm.EndBlock, &jm.Copy, &Stripe, &MediaId) == 10) {
+ &jm.StartBlock, &jm.EndBlock, &Copy, &Stripe, &MediaId) == 10) {
if (jcr->mig_jcr) {
jm.JobId = jcr->mig_jcr->JobId;
*/
void catalog_update(JCR *jcr, BSOCK *bs)
{
- POOLMEM *omsg;
-
- if (job_canceled(jcr) || !jcr->pool->catalog_files) {
- goto bail_out; /* user disabled cataloging */
+ if (!jcr->pool->catalog_files) {
+ return; /* user disabled cataloging */
+ }
+ if (job_canceled(jcr)) {
+ goto bail_out;
}
if (!jcr->db) {
- omsg = get_memory(bs->msglen+1);
+ POOLMEM *omsg = get_memory(bs->msglen+1);
pm_strcpy(omsg, bs->msg);
bs->fsend(_("1994 Invalid Catalog Update: %s"), omsg);
Jmsg1(jcr, M_FATAL, 0, _("Invalid Catalog Update; DB not open: %s"), omsg);
free_memory(omsg);
goto bail_out;
-
}
-
update_attribute(jcr, bs->msg, bs->msglen);
bail_out:
last = size;
}
}
- update_attribute(jcr, msg, msglen);
+ if (!job_canceled(jcr)) {
+ update_attribute(jcr, msg, msglen);
+ if (job_canceled(jcr)) {
+ goto bail_out;
+ }
+ }
}
if (ferror(spool_fd)) {
berrno be;