From 5ba28e4771aad4a501c362925d19c5968ea6716a Mon Sep 17 00:00:00 2001 From: Andy CA6JAU Date: Fri, 27 Jul 2018 23:42:04 -0400 Subject: [PATCH] Fix Windows compilation --- DMR2NXDN/DMR2NXDN.cpp | 10 ++++++---- DMR2YSF/DMR2YSF.cpp | 10 ++++++---- NXDN2DMR/NXDN2DMR.cpp | 10 ++++++---- YSF2DMR/YSF2DMR.cpp | 10 ++++++---- YSF2NXDN/YSF2NXDN.cpp | 10 ++++++---- YSF2P25/YSF2P25.cpp | 10 ++++++---- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/DMR2NXDN/DMR2NXDN.cpp b/DMR2NXDN/DMR2NXDN.cpp index 1571195..d0580ca 100644 --- a/DMR2NXDN/DMR2NXDN.cpp +++ b/DMR2NXDN/DMR2NXDN.cpp @@ -155,9 +155,6 @@ int CDMR2NXDN::run() return -1; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -195,8 +192,13 @@ int CDMR2NXDN::run() return 1; } - if (m_daemon) +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); ::close(STDERR_FILENO); + } +#endif m_defsrcid = m_conf.getDMRId(); diff --git a/DMR2YSF/DMR2YSF.cpp b/DMR2YSF/DMR2YSF.cpp index 56933ef..5490f83 100644 --- a/DMR2YSF/DMR2YSF.cpp +++ b/DMR2YSF/DMR2YSF.cpp @@ -158,9 +158,6 @@ int CDMR2YSF::run() return -1; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -198,8 +195,13 @@ int CDMR2YSF::run() return 1; } - if (m_daemon) +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); ::close(STDERR_FILENO); + } +#endif m_callsign = m_conf.getCallsign(); m_defsrcid = m_conf.getDMRId(); diff --git a/NXDN2DMR/NXDN2DMR.cpp b/NXDN2DMR/NXDN2DMR.cpp index 9244dd9..c8bd543 100644 --- a/NXDN2DMR/NXDN2DMR.cpp +++ b/NXDN2DMR/NXDN2DMR.cpp @@ -159,9 +159,6 @@ int CNXDN2DMR::run() return -1; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -199,8 +196,13 @@ int CNXDN2DMR::run() return 1; } - if (m_daemon) +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); ::close(STDERR_FILENO); + } +#endif m_callsign = m_conf.getCallsign(); m_nxdnTG = m_conf.getTG(); diff --git a/YSF2DMR/YSF2DMR.cpp b/YSF2DMR/YSF2DMR.cpp index c0c7fc3..07a7e8f 100644 --- a/YSF2DMR/YSF2DMR.cpp +++ b/YSF2DMR/YSF2DMR.cpp @@ -165,9 +165,6 @@ int CYSF2DMR::run() return -1; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -205,8 +202,13 @@ int CYSF2DMR::run() return 1; } - if (m_daemon) +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); ::close(STDERR_FILENO); + } +#endif m_callsign = m_conf.getCallsign(); m_suffix = m_conf.getSuffix(); diff --git a/YSF2NXDN/YSF2NXDN.cpp b/YSF2NXDN/YSF2NXDN.cpp index 598ea4b..0874b95 100644 --- a/YSF2NXDN/YSF2NXDN.cpp +++ b/YSF2NXDN/YSF2NXDN.cpp @@ -157,9 +157,6 @@ int CYSF2NXDN::run() return -1; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - //If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -197,8 +194,13 @@ int CYSF2NXDN::run() return 1; } - if (m_daemon) +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); ::close(STDERR_FILENO); + } +#endif m_callsign = m_conf.getCallsign(); m_suffix = m_conf.getSuffix(); diff --git a/YSF2P25/YSF2P25.cpp b/YSF2P25/YSF2P25.cpp index 1c1c8d1..a6929b8 100644 --- a/YSF2P25/YSF2P25.cpp +++ b/YSF2P25/YSF2P25.cpp @@ -209,9 +209,6 @@ int CYSF2P25::run() return -1; } - ::close(STDIN_FILENO); - ::close(STDOUT_FILENO); - // If we are currently root... if (getuid() == 0) { struct passwd* user = ::getpwnam("mmdvm"); @@ -249,8 +246,13 @@ int CYSF2P25::run() return 1; } - if (m_daemon) +#if !defined(_WIN32) && !defined(_WIN64) + if (m_daemon) { + ::close(STDIN_FILENO); + ::close(STDOUT_FILENO); ::close(STDERR_FILENO); + } +#endif m_callsign = m_conf.getCallsign(); m_defsrcid = m_conf.getP25Id();