diff --git a/src/system/runtime_loader/rld.c b/src/system/runtime_loader/rld.c index d4dee6a150..8f0317e54d 100644 --- a/src/system/runtime_loader/rld.c +++ b/src/system/runtime_loader/rld.c @@ -283,6 +283,7 @@ int runtime_loader(void *_args) { void *entry = NULL; + int returnCode; gProgramArgs = (struct uspace_program_args *)_args; @@ -302,6 +303,10 @@ runtime_loader(void *_args) return -1; // call the program entry point (usually _start()) - return ((int (*)(int, void *, void *))entry)(gProgramArgs->argc, + returnCode = ((int (*)(int, void *, void *))entry)(gProgramArgs->argc, gProgramArgs->argv, gProgramArgs->envp); + + terminate_program(); + + return returnCode; }