]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/jcr.c
Working directory pane in restore. Will get this into the stack next.
[bacula/bacula] / bacula / src / lib / jcr.c
old mode 100755 (executable)
new mode 100644 (file)
index 8c2c241..925227a
@@ -1,3 +1,30 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2000-2007 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
+   License as published by the Free Software Foundation plus additions
+   that are listed in the file LICENSE.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   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
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+   Bacula® is a registered trademark of John Walker.
+   The licensor of Bacula is the Free Software Foundation Europe
+   (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
+   Switzerland, email:ftf@fsfeurope.org.
+*/
 /*
  * Manipulation routines for Job Control Records and
  *  handling of last_jobs_list.
  *  re-reading of the config file, no recursion is needed.
  *
  */
-/*
-   Copyright (C) 2000-2006 Kern Sibbald
-
-   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 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,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
-   the file LICENSE for additional details.
-
- */
 
 #include "bacula.h"
 #include "jcr.h"
@@ -43,6 +56,9 @@
 /* External variables we reference */
 extern time_t watchdog_time;
 
+/* External referenced functions */
+void free_bregexps(alist *bregexps);
+
 /* Forward referenced functions */
 extern "C" void timeout_handler(int sig);
 static void jcr_timeout_check(watchdog_t *self);
@@ -231,7 +247,6 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr)
    jcr->daemon_free_jcr = daemon_free_jcr;    /* plug daemon free routine */
    jcr->init_mutex();
    jcr->inc_use_count();   
-   jcr->JobStatus = JS_Created;       /* ready to run */
    jcr->VolumeName = get_pool_memory(PM_FNAME);
    jcr->VolumeName[0] = 0;
    jcr->errmsg = get_pool_memory(PM_MESSAGE);
@@ -241,7 +256,7 @@ JCR *new_jcr(int size, JCR_free_HANDLER *daemon_free_jcr)
    jcr->JobId = 0;
    jcr->JobType = JT_SYSTEM;          /* internal job until defined */
    jcr->JobLevel = L_NONE;
-   jcr->JobStatus = JS_Created;
+   set_jcr_job_status(jcr, JS_Created);       /* ready to run */
 
    sigtimer.sa_flags = 0;
    sigtimer.sa_handler = timeout_handler;
@@ -331,7 +346,10 @@ static void free_common_jcr(JCR *jcr)
    }
    jcr->destroy_mutex();
 
-   delete jcr->msg_queue;
+   if (jcr->msg_queue) {
+      delete jcr->msg_queue;
+      jcr->msg_queue = NULL;
+   }
    close_msg(jcr);                    /* close messages for this job */
 
    /* do this after closing messages */
@@ -366,6 +384,15 @@ static void free_common_jcr(JCR *jcr)
       free(jcr->where);
       jcr->where = NULL;
    }
+   if (jcr->RegexWhere) {
+      free(jcr->RegexWhere);
+      jcr->RegexWhere = NULL;
+   }
+   if (jcr->where_bregexp) {
+      free_bregexps(jcr->where_bregexp);
+      delete jcr->where_bregexp;
+      jcr->where_bregexp = NULL;
+   }
    if (jcr->cached_path) {
       free_pool_memory(jcr->cached_path);
       jcr->cached_path = NULL;