]> granicus.if.org Git - icinga2/commitdiff
Even more fixes.
authorGunnar Beutner <gunnar@beutner.name>
Sun, 24 Jun 2012 14:39:49 +0000 (16:39 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Sun, 24 Jun 2012 14:40:58 +0000 (16:40 +0200)
icinga/i2-icinga.h
icinga/nagioschecktask.cpp
icinga/nagioschecktask.h

index e831b2b26c884f6a95861d7235b8a4e07e3f7f46..45cf6be84981a2e0e8606461ad917b64c36d5c6f 100644 (file)
 #include <i2-jsonrpc.h>
 #include <set>
 
-#ifndef _MSC_VER
-#      include "popen_noshell.h"
-#endif /* _MSC_VER */
-
 #include <boost/thread/future.hpp>
 using boost::packaged_task;
 using boost::unique_future;
index ceb0fdcf75b8691db1f65272c5183ae6bc868a0d..d0452b00e9945890071954ca9857700ba2db1e22 100644 (file)
@@ -1,5 +1,9 @@
 #include "i2-icinga.h"
 
+#ifndef _MSC_VER
+#      include "popen_noshell.h"
+#endif /* _MSC_VER */
+
 using namespace icinga;
 
 boost::mutex NagiosCheckTask::m_Mutex;
@@ -108,7 +112,9 @@ bool NagiosCheckTask::InitTask(void)
        m_FP = _popen(m_Command.c_str(), "r");
 #else /* _MSC_VER */
        if (!m_UsePopen) {
-               m_FP = popen_noshell_compat(m_Command.c_str(), "r", &m_PCloseArg);
+               m_PCloseArg = new popen_noshell_pass_to_pclose;
+
+               m_FP = popen_noshell_compat(m_Command.c_str(), "r", (popen_noshell_pass_to_pclose *)m_PCloseArg);
 
                if (m_FP == NULL) // TODO: add check for valgrind
                        m_UsePopen = true;
@@ -139,10 +145,12 @@ bool NagiosCheckTask::RunTask(void)
 #ifdef _MSC_VER
        status = _pclose(m_FP);
 #else /* _MSC_VER */
-       if (m_UsePopen)
+       if (m_UsePopen) {
                status = pclose(m_FP);
-       else
-               status = pclose_noshell(&m_PCloseArg);
+       } else {
+               status = pclose_noshell((popen_noshell_pass_to_pclose *)m_PCloseArg);
+               delete (popen_noshell_pass_to_pclose *)m_PCloseArg;
+       }
 #endif /* _MSC_VER */
 
 #ifndef _MSC_VER
index ee4ca9fcc7cd7f4ba7cdedd4c98909beb72cc111..c0601c3737427928682b87f513fd4ad5c5ca7335 100644 (file)
@@ -28,7 +28,7 @@ private:
        stringstream m_OutputStream;
        bool m_UsePopen;
 #ifndef _MSC_VER
-       popen_noshell_pass_to_pclose m_PCloseArg;
+       void *m_PCloseArg;
 #endif /* _MSC_VER */
 
        static boost::mutex m_Mutex;