diff --git a/P25Gateway/P25Gateway.cpp b/P25Gateway/P25Gateway.cpp index 9ef0e92..8f09b00 100644 --- a/P25Gateway/P25Gateway.cpp +++ b/P25Gateway/P25Gateway.cpp @@ -119,10 +119,6 @@ void CP25Gateway::run() return; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - ::close(STDERR_FILENO); - // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -160,6 +156,14 @@ void CP25Gateway::run() return; } +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); + ::close(STDERR_FILENO); + } +#endif + in_addr rptAddr = CUDPSocket::lookup(m_conf.getRptAddress()); unsigned int rptPort = m_conf.getRptPort(); diff --git a/P25Reflector/P25Reflector.cpp b/P25Reflector/P25Reflector.cpp index 0febc31..721b25c 100644 --- a/P25Reflector/P25Reflector.cpp +++ b/P25Reflector/P25Reflector.cpp @@ -119,10 +119,6 @@ void CP25Reflector::run() return; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - ::close(STDERR_FILENO); - // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -160,6 +156,14 @@ void CP25Reflector::run() return; } +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); + ::close(STDERR_FILENO); + } +#endif + CNetwork network(m_conf.getNetworkPort(), m_conf.getNetworkDebug()); ret = network.open();