aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/command_line
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-light/src/hicn/command_line')
-rw-r--r--hicn-light/src/hicn/command_line/controller/CMakeLists.txt17
-rw-r--r--hicn-light/src/hicn/command_line/daemon/CMakeLists.txt17
-rw-r--r--hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c7
3 files changed, 24 insertions, 17 deletions
diff --git a/hicn-light/src/hicn/command_line/controller/CMakeLists.txt b/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
index 405654052..949cace28 100644
--- a/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
+++ b/hicn-light/src/hicn/command_line/controller/CMakeLists.txt
@@ -14,11 +14,12 @@
list(APPEND CONTROLLER_SRC
hicnLightControl_main.c
)
-
-build_executable(${HICN_LIGHT_CONTROL}
- SOURCES ${CONTROLLER_SRC}
- LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
- DEPENDS ${LIBHICN_LIGHT_STATIC}
- COMPONENT ${HICN_LIGHT}
- DEFINITIONS ${COMPILER_DEFINITIONS}
-)
+if (NOT DISABLE_EXECUTABLES)
+ build_executable(${HICN_LIGHT_CONTROL}
+ SOURCES ${CONTROLLER_SRC}
+ LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
+ DEPENDS ${LIBHICN_LIGHT_STATIC}
+ COMPONENT ${HICN_LIGHT}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ )
+endif ()
diff --git a/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt b/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
index ff9d31ebc..1ab8a4e6f 100644
--- a/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
+++ b/hicn-light/src/hicn/command_line/daemon/CMakeLists.txt
@@ -14,11 +14,12 @@
list(APPEND DAEMON_SRC
hicnLightDaemon_main.c
)
-
-build_executable(${HICN_LIGHT_DAEMON}
- SOURCES ${DAEMON_SRC}
- LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
- DEPENDS ${LIBHICN_LIGHT_STATIC}
- COMPONENT ${HICN_LIGHT}
- DEFINITIONS ${COMPILER_DEFINITIONS}
-)
+if (NOT DISABLE_EXECUTABLES)
+ build_executable(${HICN_LIGHT_DAEMON}
+ SOURCES ${DAEMON_SRC}
+ LINK_LIBRARIES ${HICN_LIGHT_LINK_LIBRARIES}
+ DEPENDS ${LIBHICN_LIGHT_STATIC}
+ COMPONENT ${HICN_LIGHT}
+ DEFINITIONS ${COMPILER_DEFINITIONS}
+ )
+endif ()
diff --git a/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c b/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c
index c0b332b91..89a80d0b1 100644
--- a/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c
+++ b/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c
@@ -218,10 +218,15 @@ static void _daemonize(void) {
setsid();
/* close all descriptors */
+#ifdef __ANDROID__
+ for (int i = sysconf(_SC_OPEN_MAX); i >= 0; --i) {
+ close(i);
+ }
+#else
for (int i = getdtablesize(); i >= 0; --i) {
close(i);
}
-
+#endif
// reset errno because it might be seg to EBADF from the close calls above
errno = 0;