aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c')
-rw-r--r--hicn-light/src/hicn/command_line/daemon/hicnLightDaemon_main.c7
1 files changed, 6 insertions, 1 deletions
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;