]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix DiskToCatalog seg fault
authorKern Sibbald <kern@sibbald.com>
Sat, 25 Oct 2003 16:55:17 +0000 (16:55 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 25 Oct 2003 16:55:17 +0000 (16:55 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@784 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/cats/sql_find.c
bacula/src/dird/verify.c
bacula/src/lib/util.c

index 9770ef2b3dd5356d432a30b4b9dbf3d83dc521bf..f161f4a27c1198451476ed36a92e7c9bb1fc6c30 100644 (file)
@@ -38,6 +38,8 @@ For 1.33 Testing/Documentation:
 For 1.32c
 
 For 1.33
+- Automatically create pools, but instead of looking for what
+  in in Job records, walk through the pool resources.
 - Check and double check tree code, why does it take so long?
 - Upgrade to cygwin 1.5
 - Fix time difference problem between Bacula and Client
index 0939ce9e360e3a52974efc5eb1818011e9ed829d..0e39ab2c3e0d96b2b353afaa6e0244d53231e8d3 100644 (file)
@@ -160,7 +160,8 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, char *Name, JOB_DBR *jr)
    db_lock(mdb);
    if (jr->Level == L_VERIFY_CATALOG) {
       Mmsg(&mdb->cmd, 
-"SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND Name='%s' AND "
+"SELECT JobId FROM Job WHERE Type='V' AND Level='%c' AND "
+" JobStatus='T' AND Name='%s' AND "
 "ClientId=%u ORDER BY StartTime DESC LIMIT 1",
           L_VERIFY_INIT, jr->Name, jr->ClientId);
    } else if (jr->Level == L_VERIFY_VOLUME_TO_CATALOG ||
@@ -170,8 +171,8 @@ db_find_last_jobid(JCR *jcr, B_DB *mdb, char *Name, JOB_DBR *jr)
 "SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND "
 "Name='%s' ORDER BY StartTime DESC LIMIT 1", Name);
       } else {
-      Mmsg(&mdb->cmd, 
-"SELECT JobId FROM Job WHERE Type='B' AND "
+        Mmsg(&mdb->cmd, 
+"SELECT JobId FROM Job WHERE Type='B' AND JobStatus='T' AND "
 "ClientId=%u ORDER BY StartTime DESC LIMIT 1", jr->ClientId);
       }
    } else {
index fe868f6b36396d7346c68d0bc4fb4f993c4e3488..f009332510d42410bca8328546315283fe9ac342 100644 (file)
@@ -70,6 +70,10 @@ int do_verify(JCR *jcr)
    JobId_t verify_jobid = 0;
    int stat;
 
+   memset(&verify_jr, 0, sizeof(verify_jr));
+   if (!jcr->verify_jr) {
+      jcr->verify_jr = &verify_jr;
+   }
    if (!get_or_create_client_record(jcr)) {
       goto bail_out;
    }
@@ -133,7 +137,6 @@ int do_verify(JCR *jcr)
    if (jcr->JobLevel == L_VERIFY_CATALOG || 
        jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG ||
        jcr->JobLevel == L_VERIFY_DISK_TO_CATALOG) {
-      memset(&verify_jr, 0, sizeof(verify_jr));
       verify_jr.JobId = verify_jobid;
       if (!db_get_job_record(jcr, jcr->db, &verify_jr)) {
          Jmsg(jcr, M_FATAL, 0, _("Could not get job record for previous Job. ERR=%s"), 
@@ -207,7 +210,6 @@ int do_verify(JCR *jcr)
       jcr->fileset = jcr->job->verify_job->fileset;
    }
    Dmsg2(100, "ClientId=%u JobLevel=%c\n", verify_jr.ClientId, jcr->JobLevel);
-   jcr->verify_jr = &verify_jr;
 
    /*
     * OK, now connect to the File daemon
@@ -404,7 +406,7 @@ static void verify_cleanup(JCR *jcr, int TermCode)
 
    jobstatus_to_ascii(jcr->FDJobStatus, fd_term_msg, sizeof(fd_term_msg));
    if (jcr->JobLevel == L_VERIFY_VOLUME_TO_CATALOG) {
-       jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
+      jobstatus_to_ascii(jcr->SDJobStatus, sd_term_msg, sizeof(sd_term_msg));
       Jmsg(jcr, msg_type, 0, _("Bacula " VERSION " (" LSMDATE "): %s\n\
 JobId:                  %d\n\
 Job:                    %s\n\
index 3e335fb4f178caa9da3e5716da0f813adb906562..29ff4bae374260fc05285fb4b9595eed334b86b2 100644 (file)
@@ -145,7 +145,8 @@ int pm_strcpy(POOLMEM **pm, char *str)
  */
 void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen)
 {
-   char *termstat, jstat[2];
+   char *termstat;
+   char buf[100];
 
    switch (JobStatus) {
       case JS_Terminated:
@@ -165,9 +166,12 @@ void jobstatus_to_ascii(int JobStatus, char *msg, int maxlen)
          termstat = _("Verify differences");
         break;
      default:
-        jstat[0] = last_job.JobStatus;
-        jstat[1] = 0;
-        termstat = jstat;
+        if (JobStatus == 0) {
+           buf[0] = 0;
+        } else {
+            bsnprintf(buf, sizeof(buf), _("Unknown Job termination status=%d"), JobStatus);
+        }
+        termstat = buf;
         break;
    }
    bstrncpy(msg, termstat, maxlen);