Skip to content

Commit 524508f

Browse files
mtjhrctylerfanelli
authored andcommitted
init: Report an error when execution of the user binary fails
Previosly running a non existing binary would just silently fail, now it reports an error. Signed-off-by: Matej Hrica <[email protected]>
1 parent 1168fb9 commit 524508f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

init/init.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -848,7 +848,10 @@ int main(int argc, char **argv)
848848
}
849849
#endif
850850

851-
execvp(exec_argv[0], exec_argv);
851+
if (execvp(exec_argv[0], exec_argv) < 0) {
852+
printf("Couldn't execute '%s' inside the vm: %s\n", exec_argv[0], strerror(errno));
853+
exit(-3);
854+
}
852855

853856
return 0;
854857
}

0 commit comments

Comments
 (0)