This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
- version 2 as ammended with additional clauses defined in the
+ version 2 as amended with additional clauses defined in the
file LICENSE in the main source directory.
This program is distributed in the hope that it will be useful,
admin_cleanup(jcr, JS_ErrorTerminated);
}
break;
- case JT_MIGRATION:
+ case JT_MIGRATE:
case JT_COPY:
case JT_ARCHIVE:
if (!do_mac_init(jcr)) { /* migration, archive, copy */
}
break;
default:
- Pmsg1(0, "Unimplemented job type: %d\n", jcr->JobType);
+ Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->JobType);
set_jcr_job_status(jcr, JS_ErrorTerminated);
break;
}
admin_cleanup(jcr, JS_ErrorTerminated);
}
break;
- case JT_MIGRATION:
+ case JT_MIGRATE:
case JT_COPY:
case JT_ARCHIVE:
if (do_mac(jcr)) { /* migration, archive, copy */
}
break;
default:
- Pmsg1(0, "Unimplemented job type: %d\n", jcr->JobType);
+ Pmsg1(0, _("Unimplemented job type: %d\n"), jcr->JobType);
break;
}
if ((jcr->job->RunAfterJob && jcr->JobStatus == JS_Terminated) ||
* Cancel a job -- typically called by the UA (Console program), but may also
* be called by the job watchdog.
*
- * Returns: 1 if cancel appears to be successful
- * 0 on failure. Message sent to ua->jcr.
+ * Returns: true if cancel appears to be successful
+ * false on failure. Message sent to ua->jcr.
*/
-int cancel_job(UAContext *ua, JCR *jcr)
+bool cancel_job(UAContext *ua, JCR *jcr)
{
BSOCK *sd, *fd;
bsendmsg(ua, _("JobId %d, Job %s marked to be canceled.\n"),
jcr->JobId, jcr->Job);
jobq_remove(&job_queue, jcr); /* attempt to remove it from queue */
- return 1;
+ return true;
default:
}
if (!connect_to_storage_daemon(ua->jcr, 10, SDConnectTimeout, 1)) {
bsendmsg(ua, _("Failed to connect to Storage daemon.\n"));
- return 0;
+ return false;
}
Dmsg0(200, "Connected to storage daemon\n");
sd = ua->jcr->store_bsock;
}
}
- return 1;
+ return true;
}
static void job_monitor_destructor(watchdog_t *self)
{
- JCR *control_jcr = (JCR *) self->data;
+ JCR *control_jcr = (JCR *)self->data;
free_jcr(control_jcr);
}
if (jcr->JobId == 0) {
Dmsg2(800, "Skipping JCR %p (%s) with JobId 0\n",
jcr, jcr->Job);
- /* Keep reference counts correct */
- free_jcr(jcr);
continue;
}
cancel_job(ua, jcr);
free_ua_context(ua);
- Dmsg1(800, "Have cancelled JCR %p\n", jcr);
+ Dmsg2(800, "Have cancelled JCR %p Job=%d\n", jcr, jcr->JobId);
}
/* Keep reference counts correct */
- free_jcr(jcr);
}
+ endeach_jcr(jcr);
}
/*
return true;
}
-bool get_or_create_fileset_record(JCR *jcr, FILESET_DBR *fsr)
+bool get_or_create_fileset_record(JCR *jcr)
{
+ FILESET_DBR fsr;
/*
* Get or Create FileSet record
*/
- memset(fsr, 0, sizeof(FILESET_DBR));
- bstrncpy(fsr->FileSet, jcr->fileset->hdr.name, sizeof(fsr->FileSet));
+ memset(&fsr, 0, sizeof(FILESET_DBR));
+ bstrncpy(fsr.FileSet, jcr->fileset->hdr.name, sizeof(fsr.FileSet));
if (jcr->fileset->have_MD5) {
struct MD5Context md5c;
- unsigned char signature[16];
+ unsigned char digest[MD5HashSize];
memcpy(&md5c, &jcr->fileset->md5c, sizeof(md5c));
- MD5Final(signature, &md5c);
- bin_to_base64(fsr->MD5, (char *)signature, 16); /* encode 16 bytes */
- bstrncpy(jcr->fileset->MD5, fsr->MD5, sizeof(jcr->fileset->MD5));
+ MD5Final(digest, &md5c);
+ bin_to_base64(fsr.MD5, (char *)digest, MD5HashSize);
+ bstrncpy(jcr->fileset->MD5, fsr.MD5, sizeof(jcr->fileset->MD5));
} else {
- Jmsg(jcr, M_WARNING, 0, _("FileSet MD5 signature not found.\n"));
+ Jmsg(jcr, M_WARNING, 0, _("FileSet MD5 digest not found.\n"));
}
if (!jcr->fileset->ignore_fs_changes ||
- !db_get_fileset_record(jcr, jcr->db, fsr)) {
- if (!db_create_fileset_record(jcr, jcr->db, fsr)) {
+ !db_get_fileset_record(jcr, jcr->db, &fsr)) {
+ if (!db_create_fileset_record(jcr, jcr->db, &fsr)) {
Jmsg(jcr, M_ERROR, 0, _("Could not create FileSet \"%s\" record. ERR=%s\n"),
- fsr->FileSet, db_strerror(jcr->db));
+ fsr.FileSet, db_strerror(jcr->db));
return false;
}
}
- jcr->jr.FileSetId = fsr->FileSetId;
-#ifdef needed
- if (fsr->created && jcr != NULL) {
- Jmsg(jcr, M_INFO, 0, _("Created new FileSet record \"%s\" %s\n"),
- fsr->FileSet, fsr->cCreateTime);
- }
-#endif
+ jcr->jr.FileSetId = fsr.FileSetId;
+ bstrncpy(jcr->FSCreateTime, fsr.cCreateTime, sizeof(jcr->FSCreateTime));
Dmsg2(119, "Created FileSet %s record %u\n", jcr->fileset->hdr.name,
jcr->jr.FileSetId);
return true;
pthread_cond_destroy(&jcr->term_wait);
jcr->term_wait_inited = false;
}
+ if (jcr->attr) {
+ free_pool_memory(jcr->attr);
+ jcr->attr = NULL;
+ }
+ if (jcr->ar) {
+ free(jcr->ar);
+ jcr->ar = NULL;
+ }
}
/*