aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-10-27 20:29:24 +0100
committerSimon Glass <sjg@chromium.org>2020-11-05 09:11:30 -0700
commitc0b19f25a1a2ba935333899e5dcbe4429851cb18 (patch)
tree6bf06e419dfb99bd42374627419b7d94743d44b5
parent35d949222f5fc629cf89063a39998fbc39c2c4ca (diff)
downloadu-boot-c0b19f25a1a2ba935333899e5dcbe4429851cb18.tar.gz
sandbox: use O_CLOEXEC in os_open()
During a cold reset execv() is used to relaunch the U-Boot binary. We must ensure that all files are closed in this case. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--arch/sandbox/cpu/os.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index c461fb0db0..7e474d6364 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -80,6 +80,11 @@ 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);
}