diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2017-06-01 10:08:31 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-06-01 10:08:33 +0200 |
commit | 8e5a534df784ab91ffde55ed5038e66e8dbb36c8 (patch) | |
tree | 4aa319f27aa7b3dbe31b77b8e18abb4e1cb59395 /arch/sandbox/os | |
parent | a8de37dbef75665b6bdd98e9ce54f9fb20484785 (diff) | |
download | barebox-8e5a534df784ab91ffde55ed5038e66e8dbb36c8.tar.gz barebox-8e5a534df784ab91ffde55ed5038e66e8dbb36c8.tar.xz |
sandbox: Fix registering file/fifo consoles
barebox_register_console() uses xzalloc which requires the malloc pool
to be initialized, so call it during the second option parsing when
this is already done.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox/os')
-rw-r--r-- | arch/sandbox/os/common.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/sandbox/os/common.c b/arch/sandbox/os/common.c index 192917ac22..8cf0873130 100644 --- a/arch/sandbox/os/common.c +++ b/arch/sandbox/os/common.c @@ -359,24 +359,6 @@ int main(int argc, char *argv[]) exit(1); } break; - case 'O': - fd = open(optarg, O_WRONLY); - if (fd < 0) { - perror("open"); - exit(1); - } - - barebox_register_console(-1, fd); - break; - case 'I': - fd = open(optarg, O_RDWR); - if (fd < 0) { - perror("open"); - exit(1); - } - - barebox_register_console(fd, -1); - break; case 'x': sdl_xres = strtoul(optarg, NULL, 0); break; @@ -384,7 +366,7 @@ int main(int argc, char *argv[]) sdl_yres = strtoul(optarg, NULL, 0); break; default: - exit(1); + break; } } @@ -421,6 +403,24 @@ int main(int argc, char *argv[]) if (ret) exit(1); break; + case 'O': + fd = open(optarg, O_WRONLY); + if (fd < 0) { + perror("open"); + exit(1); + } + + barebox_register_console(-1, fd); + break; + case 'I': + fd = open(optarg, O_RDWR); + if (fd < 0) { + perror("open"); + exit(1); + } + + barebox_register_console(fd, -1); + break; default: break; } |