diff options
author | Tom Rini <trini@konsulko.com> | 2020-11-06 11:27:14 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-11-06 11:27:14 -0500 |
commit | 22ad69b7987eb4b10221330661db4427e40174fb (patch) | |
tree | b13bc4ba708907cd76a0ec09c4599b55cb586953 /arch/sandbox/cpu/os.c | |
parent | 896cc5aa4a8fc0c28036b9615a37f0034addad44 (diff) | |
parent | dc4b2a9770b5b932cd6d98c33ebff6dc46de6849 (diff) |
Merge tag 'dm-pull5nov20' of git://git.denx.de/u-boot-dm
patman status subcommand to collect tags from Patchwork
patman showing email replies from Patchwork
sandbox poweroff command
minor fixes in binman, tests
Diffstat (limited to 'arch/sandbox/cpu/os.c')
-rw-r--r-- | arch/sandbox/cpu/os.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index e7ec892bdf0..0d8efd83f62 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -80,13 +80,21 @@ int os_open(const char *pathname, int os_flags) flags |= O_CREAT; if (os_flags & OS_O_TRUNC) flags |= O_TRUNC; + /* + * During a cold reset execv() is used to relaunch the U-Boot binary. + * We must ensure that all files are closed in this case. + */ + flags |= O_CLOEXEC; return open(pathname, flags, 0777); } int os_close(int fd) { - return close(fd); + /* Do not close the console input */ + if (fd) + return close(fd); + return -1; } int os_unlink(const char *pathname) @@ -814,3 +822,9 @@ void *os_find_text_base(void) return base; } + +void os_relaunch(char *argv[]) +{ + execv(argv[0], argv); + os_exit(1); +} |