]> granicus.if.org Git - icinga2/commitdiff
Inherit parent process arguments for defined path constants
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 27 Sep 2018 18:05:25 +0000 (20:05 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 19 Jun 2019 12:46:11 +0000 (14:46 +0200)
lib/remote/apilistener-filesync.cpp

index 8fe90ee433119deaa95594cf9ee55edc8ddc2e8b..87f1be475599b774031c8902d3338e4577f49fb7 100644 (file)
@@ -394,15 +394,24 @@ void ApiListener::AsyncTryActivateZonesStage(const String& stageConfigDir, const
 {
        VERIFY(Application::GetArgC() >= 1);
 
-       // prepare arguments
+       /* Inherit parent process args. */
        Array::Ptr args = new Array({
                Application::GetExePath(Application::GetArgV()[0]),
-               "daemon",
-               "--validate",
-               "--define",
-               "System.ZonesStageVarDir='" + GetApiZonesStageDir() + "'" //Path is written onto the shell
        });
 
+       for (int i = 1; i < Application::GetArgC(); i++) {
+               String argV = Application::GetArgV()[i];
+
+               if (argV == "-d" || argV == "--daemonize")
+                       continue;
+
+               args->Add(argV);
+       }
+
+       args->Add("--validate");
+       args->Add("--define");
+       args->Add("System.ZonesStageVarDir='" + GetApiZonesStageDir() + "'");
+
        Process::Ptr process = new Process(Process::PrepareCommand(args));
        process->SetTimeout(300);
        process->Run(std::bind(&TryActivateZonesStageCallback, _1, stageConfigDir, currentConfigDir, relativePaths, reload));