]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
metaplugin: Include bacula jobid in the backend calls as BACULA_JOBID env variable
authorJorge Gea <jorge.gea@baculasystems.com>
Tue, 9 Jul 2024 16:00:37 +0000 (18:00 +0200)
committerEric Bollengier <eric@baculasystems.com>
Wed, 4 Dec 2024 08:14:26 +0000 (09:14 +0100)
bacula/src/plugins/fd/pluginlib/metaplugin.cpp

index d344c7ae575b648253b59f3fb2c06cd208c192a0..2a20ce3551c1a1fe4c5c750b946374f644d7cc02 100644 (file)
@@ -462,7 +462,13 @@ bRC METAPLUGIN::run_backend(bpContext *ctx)
       return bRC_Error;
    }
    DMSG(ctx, DINFO, "Executing: %s\n", backend_cmd.c_str());
-   bp = open_bpipe(backend_cmd.c_str(), 0, "rwe");
+   char ed1[64];
+   bsnprintf(ed1, sizeof(ed1), "BACULA_JOBID=%d", JobId);
+   char *envp[] = {
+      ed1,
+      NULL
+   };
+   bp = open_bpipe(backend_cmd.c_str(), 0, "rwe", envp);
    if (bp == NULL){
       berrno be;
       DMSG(ctx, DERROR, "Unable to run backend. Err=%s\n", be.bstrerror());