X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fprocess.c;h=51c9e2a04f2b04d437554488c1d8f922877ae7b1;hp=020dfa0db65f59561c58ca81c260c7b1e834d329;hb=0821e327f23d81e4b001479b9de62151a3c0a1bc;hpb=fb5fcc575d25a51acf73d476f63ce72f30cda6c2 diff --git a/src/process.c b/src/process.c index 020dfa0d..51c9e2a0 100644 --- a/src/process.c +++ b/src/process.c @@ -254,7 +254,7 @@ static bool write_pidfile(void) { /* if it's locked, write-protected, or whatever */ if(!write_pid(pidfilename)) { - fprintf(stderr, "Could write pid file %s: %s\n", pidfilename, strerror(errno)); + fprintf(stderr, "Couldn't write pid file %s: %s\n", pidfilename, strerror(errno)); return false; } @@ -349,15 +349,19 @@ bool detach(void) { bool execute_script(const char *name, char **envp) { #ifdef HAVE_SYSTEM - int status, len; char *scriptname; - int i; char *interpreter = NULL; + config_t *cfg_interpreter; + int status, len, i; + cfg_interpreter = lookup_config(config_tree, "ScriptsInterpreter"); #ifndef HAVE_MINGW len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name); #else - len = xasprintf(&scriptname, "\"%s/%s.bat\"", confbase, name); + if(cfg_interpreter) + len = xasprintf(&scriptname, "\"%s/%s\"", confbase, name); + else + len = xasprintf(&scriptname, "\"%s/%s.bat\"", confbase, name); #endif if(len < 0) return false; @@ -365,14 +369,13 @@ bool execute_script(const char *name, char **envp) { scriptname[len - 1] = '\0'; /* First check if there is a script */ - if(access(scriptname + 1, F_OK)) { free(scriptname); return true; } // Custom scripts interpreter - if(get_config_string(lookup_config(config_tree, "ScriptsInterpreter"), &interpreter)) { + if(get_config_string(cfg_interpreter, &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);