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:
parent
4df23d9a36
commit
fffefeba8f
1 changed files with 3 additions and 0 deletions
|
@ -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 ||
|
||||||
|
|
Loading…
Reference in a new issue