1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Fix execve(2) keeping program descriptors open.

This commit is contained in:
Jonas 'Sortie' Termansen 2015-07-09 18:32:30 +02:00
parent 4df23d9a36
commit fffefeba8f

View file

@ -1169,6 +1169,7 @@ int sys_execve_kernel(const char* filename,
Ref<Descriptor> desc = from->open(&ctx, filename, O_EXEC | O_READ, 0); Ref<Descriptor> desc = from->open(&ctx, filename, O_EXEC | O_READ, 0);
if ( !desc ) if ( !desc )
return -1; return -1;
from.Reset();
struct stat st; struct stat st;
if ( desc->stat(&ctx, &st) ) if ( desc->stat(&ctx, &st) )
@ -1195,6 +1196,8 @@ int sys_execve_kernel(const char* filename,
sofar += amount; sofar += amount;
} }
desc.Reset();
int result = process->Execute(filename, buffer, filesize, argc, argv, envc, envp, regs); int result = process->Execute(filename, buffer, filesize, argc, argv, envc, envp, regs);
if ( result == 0 || errno != ENOEXEC || if ( result == 0 || errno != ENOEXEC ||