hush: catch errors from execute_binfmt
execute_binfmt may return negative return values which hush interprets as 'exit'. Catch this and print an error message instead. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
16edced39e
commit
4d902142a5
|
@ -785,12 +785,17 @@ static int run_pipe_real(struct p_context *ctx, struct pipe *pi)
|
|||
|
||||
remove_quotes(globbuf.gl_pathc, globbuf.gl_pathv);
|
||||
|
||||
if (!strcmp(globbuf.gl_pathv[0], "getopt"))
|
||||
if (!strcmp(globbuf.gl_pathv[0], "getopt")) {
|
||||
ret = builtin_getopt(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv);
|
||||
else if (!strcmp(globbuf.gl_pathv[0], "exit"))
|
||||
} else if (!strcmp(globbuf.gl_pathv[0], "exit")) {
|
||||
ret = builtin_exit(ctx, child, globbuf.gl_pathc, globbuf.gl_pathv);
|
||||
else
|
||||
} else {
|
||||
ret = execute_binfmt(globbuf.gl_pathc, globbuf.gl_pathv);
|
||||
if (ret < 0) {
|
||||
printf("%s: %s\n", globbuf.gl_pathv[0], strerror(-ret));
|
||||
ret = 127;
|
||||
}
|
||||
}
|
||||
|
||||
globfree(&globbuf);
|
||||
|
||||
|
|
Loading…
Reference in New Issue