]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/pythonsd.c
kes Fix mtx-changer to detect both versions of Ubuntu (Debian)
[bacula/bacula] / bacula / src / stored / pythonsd.c
index b728de9402334279c4d96fe286d1881cf8dbc2cc..95f4fef482c113b00fdbcdc57cdb49fb78440a3a 100644 (file)
@@ -1,3 +1,30 @@
+/*
+   Bacula® - The Network Backup Solution
+
+   Copyright (C) 2005-2008 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 and included
+   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.
+*/
 /*
  *
  * Bacula interface to Python for the Storage Daemon
@@ -8,25 +35,6 @@
  *
  */
 
-/*
-   Copyright (C) 2005 Kern Sibbald
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of
-   the License, or (at your option) any later version.
-
-   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., 59 Temple Place - Suite 330, Boston,
-   MA 02111-1307, USA.
-
- */
 
 #include "bacula.h"
 #include "stored.h"
@@ -51,7 +59,7 @@ PyMethodDef JobMethods[] = {
 
 struct s_vars {
    const char *name;
-   char *fmt;
+   const char *fmt;
 };
 
 static struct s_vars getvars[] = {
@@ -199,7 +207,7 @@ static PyObject *set_job_events(PyObject *self, PyObject *arg)
 
    Dmsg0(100, "In set_job_events.\n");
    if (!PyArg_ParseTuple(arg, "O:set_events", &eObject)) {
-      Dmsg0(000, _("Error in ParseTuple\n"));
+      Pmsg0(000, _("Error in ParseTuple\n"));
       return NULL;
    }
    jcr = get_jcr_from_PyObject(self);
@@ -215,7 +223,7 @@ static PyObject *job_write(PyObject *self, PyObject *args)
    char *text = NULL;
 
    if (!PyArg_ParseTuple(args, "s:write", &text)) {
-      Dmsg0(000, _("Parse tuple error in job_write\n"));
+      Pmsg0(000, _("Parse tuple error in job_write\n"));
       return NULL;
    }
    if (text) {
@@ -238,7 +246,8 @@ int generate_job_event(JCR *jcr, const char *event)
       return 0;
    }
 
-   PyEval_AcquireLock();
+   lock_python();
+// PyEval_AcquireLock();
 
    method = find_method(events, method, event);
    if (!method) {
@@ -259,7 +268,8 @@ int generate_job_event(JCR *jcr, const char *event)
    Py_XDECREF(result);
 
 bail_out:
-   PyEval_ReleaseLock();
+   unlock_python();
+// PyEval_ReleaseLock();
    return stat;
 }