Commit 1609dfac authored by rswindell's avatar rswindell
Browse files

Ignore shebang (#!) first lines in *all* flavors of JSexec (not just *nix),

just in case someone shares files which have that line, it can still be
executed on Windows systems (with jsexec).
parent 68c7df87
......@@ -885,10 +885,9 @@ long js_exec(const char *fname, char** args)
if(!fgets(line,sizeof(line),fp))
break;
line_no++;
#if defined(__unix__) /* Support Unix Shell Scripts that start with #!/path/to/jsexec */
/* Support Unix Shell Scripts that start with #!/path/to/jsexec */
if(line_no==1 && strncmp(line,"#!",2)==0)
strcpy(line,"\n"); /* To keep line count correct */
#endif
len=strlen(line);
if((js_buf=realloc(js_buf,js_buflen+len))==NULL) {
lprintf(LOG_ERR,"!Error allocating %u bytes of memory"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment