mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-22 21:24:41 +02:00
Even more fixes.
This commit is contained in:
parent
1cffed4b43
commit
ba4d550fec
@ -31,10 +31,6 @@
|
|||||||
#include <i2-jsonrpc.h>
|
#include <i2-jsonrpc.h>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
|
||||||
# include "popen_noshell.h"
|
|
||||||
#endif /* _MSC_VER */
|
|
||||||
|
|
||||||
#include <boost/thread/future.hpp>
|
#include <boost/thread/future.hpp>
|
||||||
using boost::packaged_task;
|
using boost::packaged_task;
|
||||||
using boost::unique_future;
|
using boost::unique_future;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#include "i2-icinga.h"
|
#include "i2-icinga.h"
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
# include "popen_noshell.h"
|
||||||
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
boost::mutex NagiosCheckTask::m_Mutex;
|
boost::mutex NagiosCheckTask::m_Mutex;
|
||||||
@ -108,7 +112,9 @@ bool NagiosCheckTask::InitTask(void)
|
|||||||
m_FP = _popen(m_Command.c_str(), "r");
|
m_FP = _popen(m_Command.c_str(), "r");
|
||||||
#else /* _MSC_VER */
|
#else /* _MSC_VER */
|
||||||
if (!m_UsePopen) {
|
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
|
if (m_FP == NULL) // TODO: add check for valgrind
|
||||||
m_UsePopen = true;
|
m_UsePopen = true;
|
||||||
@ -139,10 +145,12 @@ bool NagiosCheckTask::RunTask(void)
|
|||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
status = _pclose(m_FP);
|
status = _pclose(m_FP);
|
||||||
#else /* _MSC_VER */
|
#else /* _MSC_VER */
|
||||||
if (m_UsePopen)
|
if (m_UsePopen) {
|
||||||
status = pclose(m_FP);
|
status = pclose(m_FP);
|
||||||
else
|
} else {
|
||||||
status = pclose_noshell(&m_PCloseArg);
|
status = pclose_noshell((popen_noshell_pass_to_pclose *)m_PCloseArg);
|
||||||
|
delete (popen_noshell_pass_to_pclose *)m_PCloseArg;
|
||||||
|
}
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
|
@ -28,7 +28,7 @@ private:
|
|||||||
stringstream m_OutputStream;
|
stringstream m_OutputStream;
|
||||||
bool m_UsePopen;
|
bool m_UsePopen;
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
popen_noshell_pass_to_pclose m_PCloseArg;
|
void *m_PCloseArg;
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
static boost::mutex m_Mutex;
|
static boost::mutex m_Mutex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user