Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Yoann Congal <yoann.congal@smile.fr>,
	 openembedded-core@lists.openembedded.org,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Pavel Modilaynen <pavelmn@axis.com>, Mingli Yu <mingli.yu@windriver.com>
Subject: Re: [OE-core] [pseudo][PATCH 1/1] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak
Date: Wed, 01 Mar 2023 10:18:12 +0000	[thread overview]
Message-ID: <2f16fcecb9cd27461415cb135f1beee5061be1b1.camel@linuxfoundation.org> (raw)
In-Reply-To: <20230301000302.93660-2-yoann.congal@smile.fr>

On Wed, 2023-03-01 at 01:03 +0100, Yoann Congal wrote:
> 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.
> 
> Fixes [YOCTO #13311]
> 
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> ---
>  pseudo_util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pseudo_util.c b/pseudo_util.c
> index 64636b7..b58036f 100644
> --- a/pseudo_util.c
> +++ b/pseudo_util.c
> @@ -1611,7 +1611,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 {

Thanks. I've put this on the oe-core-next branch in the pseudo repo.
I'm hoping Alexandre could run a test build please?

Cheers,

Richard


      parent reply	other threads:[~2023-03-01 10:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-01  0:03 [pseudo][PATCH 0/1] pseudo_util.c: Open file with O_CLOEXEC to avoid fd leak Yoann Congal
2023-03-01  0:03 ` [pseudo][PATCH 1/1] " Yoann Congal
2023-03-01  8:52   ` [OE-core] " Alexandre Belloni
2023-03-01  9:00     ` Yoann Congal
2023-03-01  9:04       ` Alexander Kanavin
2023-03-01 10:16       ` Richard Purdie
2023-03-01 10:18   ` Richard Purdie [this message]

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=2f16fcecb9cd27461415cb135f1beee5061be1b1.camel@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=mingli.yu@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=pavelmn@axis.com \
    --cc=yoann.congal@smile.fr \
    /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