]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/bsys.c
Make PurgeMigrationJob directive name correspond to doc
[bacula/bacula] / bacula / src / lib / bsys.c
index c1a638e88ae96ca3bc0806c7178eea08679e1cc0..561d0bb723a8f49ed60ec08be823a0644917f32b 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2000-2010 Free Software Foundation Europe e.V.
+   Copyright (C) 2000-2011 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.
@@ -547,12 +547,15 @@ bail_out:
 /*
  * Write the state file
  */
+static pthread_mutex_t state_mutex = PTHREAD_MUTEX_INITIALIZER;
+
 void write_state_file(char *dir, const char *progname, int port)
 {
    int sfd;
    bool ok = false;
    POOLMEM *fname = get_pool_memory(PM_FNAME);
-
+   
+   P(state_mutex);                    /* Only one job at a time can call here */
    Mmsg(&fname, "%s/%s.%d.state", dir, progname, port);
    /* Create new state file */
    unlink(fname);
@@ -590,6 +593,7 @@ bail_out:
    if (!ok) {
       unlink(fname);
    }
+   V(state_mutex);
    free_pool_memory(fname);
 }