mirror of
https://codeberg.org/TicklishHoneyBee/CLIte.git
synced 2026-03-11 09:04:37 +00:00
add a file type check to exec()
This commit is contained in:
parent
0a9e229841
commit
755c79dd46
2 changed files with 7 additions and 2 deletions
|
|
@ -2253,7 +2253,12 @@ clite.lib = {
|
|||
|
||||
if (!fd.canexec) {
|
||||
clite.io.close(io.pid,fd);
|
||||
return -3
|
||||
return -3;
|
||||
}
|
||||
|
||||
if (clite.lib.getFileType(fd) != clite.io.types.FT_BINARY) {
|
||||
clite.io.close(io.pid,fd);
|
||||
return -4;
|
||||
}
|
||||
|
||||
clite.proc.update(args.join(' '));
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ clite.commands.load('sh',function(args,env,io) {
|
|||
io.exit(-1);
|
||||
}
|
||||
|
||||
if (r == -3) {
|
||||
if (r == -3 || r == -4) {
|
||||
stdio.write(io.stderr,'Shell: not an executable file:'+args[0]);
|
||||
io.exit(-3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue