summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
241670e)
When using 'ScriptsInterpreter' variable, we incorrectly
checked for '.bat' ending scripts while later building
scriptname without extension.
bool execute_script(const char *name, char **envp) {
#ifdef HAVE_SYSTEM
bool execute_script(const char *name, char **envp) {
#ifdef HAVE_SYSTEM
char *interpreter = NULL;
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
#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;
#endif
if(len < 0)
return false;
scriptname[len - 1] = '\0';
/* First check if there is a script */
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(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);
// 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);