X-Git-Url: https://git.librecmc.org/?p=oweals%2Ftinc.git;a=blobdiff_plain;f=src%2Fprocess.c;h=b76e81cd3430d66161b66e2a6432d1407ace0b3d;hp=0007943ab6332899490ce3732fca5bb483729a77;hb=2a3e343c7228d5f07176e4b404d895c7adc5bdf9;hpb=e764ff7be9949c91865aff72844357e76ae6dd78 diff --git a/src/process.c b/src/process.c index 0007943..b76e81c 100644 --- a/src/process.c +++ b/src/process.c @@ -1,7 +1,7 @@ /* process.c -- process management functions Copyright (C) 1999-2005 Ivo Timmermans, - 2000-2009 Guus Sliepen + 2000-2011 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include "device.h" #include "edge.h" #include "logger.h" +#include "net.h" #include "node.h" #include "pidfile.h" #include "process.h" @@ -41,10 +42,9 @@ extern char *identname; extern char *pidfilename; extern char **g_argv; extern bool use_logfile; -extern volatile bool running; #ifndef HAVE_MINGW -sigset_t emptysigset; +static sigset_t emptysigset; #endif static int saved_debug_level = -1; @@ -358,6 +358,7 @@ bool execute_script(const char *name, char **envp) { int status, len; char *scriptname; int i; + char *interpreter = NULL; #ifndef HAVE_MINGW len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name); @@ -369,14 +370,22 @@ bool execute_script(const char *name, char **envp) { scriptname[len - 1] = '\0'; -#ifndef HAVE_TUNEMU /* First check if there is a script */ if(access(scriptname + 1, F_OK)) { free(scriptname); return true; } -#endif + + // Custom scripts interpreter + if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &interpreter)) { + // Force custom scripts interpreter allowing execution of scripts on android without execution flag (such as on /sdcard) + free(scriptname); + len = xasprintf(&scriptname, "%s \"%s/%s\"", interpreter, confbase, name); + free(interpreter); + if(len < 0) + return false; + } ifdebug(STATUS) logger(LOG_INFO, "Executing script %s", name); @@ -511,7 +520,7 @@ static RETSIGTYPE sigusr1_handler(int a) { } static RETSIGTYPE sigusr2_handler(int a) { - dump_device_stats(); + devops.dump_stats(); dump_nodes(); dump_edges(); dump_subnets(); @@ -546,6 +555,7 @@ static struct { {SIGCHLD, ignore_signal_handler}, {SIGALRM, sigalrm_handler}, {SIGWINCH, sigwinch_handler}, + {SIGABRT, SIG_DFL}, {0, NULL} }; #endif