Openembedded Core Discussions
 help / color / mirror / Atom feed
* [pseudo][PATCH] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak
@ 2020-04-09  2:38 Yu, Mingli
  2020-04-09  3:02 ` ✗ patchtest: failure for " Patchwork
  2020-04-09  5:25 ` [OE-core] [pseudo][PATCH] " Seebs
  0 siblings, 2 replies; 5+ messages in thread
From: Yu, Mingli @ 2020-04-09  2:38 UTC (permalink / raw)
  To: openembedded-core, seebs, randy.macleod; +Cc: pavelmn

From: Pavel Modilaynen <pavelmn@axis.com>

Use close-on-exec (O_CLOEXEC) flag when open log file to
make sure its file descriptor is not leaked to parent
process on fork/exec.

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 pseudo_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pseudo_util.c b/pseudo_util.c
index c867ed6..0ec527b 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -1594,7 +1594,7 @@ pseudo_logfile(char *filename, char *defname, int prefer_fd) {
 		}
 		free(filename);
 	}	
-	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT, 0644);
+	fd = open(pseudo_path, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, 0644);
 	if (fd == -1) {
 		pseudo_diag("help: can't open log file %s: %s\n", pseudo_path, strerror(errno));
 	} else {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-09 20:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-09  2:38 [pseudo][PATCH] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak Yu, Mingli
2020-04-09  3:02 ` ✗ patchtest: failure for " Patchwork
2020-04-09  5:25 ` [OE-core] [pseudo][PATCH] " Seebs
2020-04-09  6:30   ` Yu, Mingli
2020-04-09 15:17     ` Seebs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox