From 8a6f278fd2606c0a8f133f05df83b2649eacf6c3 Mon Sep 17 00:00:00 2001 From: Vilbrekin Date: Wed, 22 Aug 2012 10:46:24 +0200 Subject: [PATCH] Basic patch for android cross-compilation. Commented non-existing functions in android NDK. Prefix scripts execution with shell binary to allow execution on no-exec mount points. Everyything is currently hard coded, while it should use pre-compiler variables... --- src/process.c | 10 ++++++++++ src/tincd.c | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/process.c b/src/process.c index f33355c..41a1468 100644 --- a/src/process.c +++ b/src/process.c @@ -376,6 +376,16 @@ bool execute_script(const char *name, char **envp) { free(scriptname); return true; } + else + { + // Ugly hard-code allowing execution of scripts on android without execution flag (such as on /sdcard) + free(scriptname); + len = xasprintf(&scriptname, "/system/bin/sh \"%s/%s\"", confbase, name); + if(len < 0) + { + return false; + } + } #endif ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name); diff --git a/src/tincd.c b/src/tincd.c index 4f03db6..7b74cd6 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -467,8 +467,9 @@ static bool drop_privs() { "initgroups", strerror(errno)); return false; } - endgrent(); - endpwent(); + // Not supported in android NDK + //endgrent(); + //endpwent(); } if (do_chroot) { tzset(); /* for proper timestamps in logs */ -- 2.25.1