From: "Yu, Mingli" <mingli.yu@windriver.com>
To: <openembedded-core@lists.openembedded.org>, <seebs@seebs.net>,
<randy.macleod@windriver.com>
Cc: <pavelmn@axis.com>
Subject: [pseudo][PATCH] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak
Date: Thu, 9 Apr 2020 10:38:41 +0800 [thread overview]
Message-ID: <1586399921-418794-1-git-send-email-mingli.yu@windriver.com> (raw)
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
next reply other threads:[~2020-04-09 2:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 2:38 Yu, Mingli [this message]
2020-04-09 3:02 ` ✗ patchtest: failure for pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak Patchwork
2020-04-09 5:25 ` [OE-core] [pseudo][PATCH] " Seebs
2020-04-09 6:30 ` Yu, Mingli
2020-04-09 15:17 ` Seebs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1586399921-418794-1-git-send-email-mingli.yu@windriver.com \
--to=mingli.yu@windriver.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=pavelmn@axis.com \
--cc=randy.macleod@windriver.com \
--cc=seebs@seebs.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox