public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top
Subject: Re: [PATCH] passt: Truncate PID file on open()
Date: Sat, 23 Jul 2022 12:27:25 +1000	[thread overview]
Message-ID: <YttcjZrOOWx7gh29@yekko> (raw)
In-Reply-To: <20220722174232.438316-1-sbrivio@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

On Fri, Jul 22, 2022 at 07:42:32PM +0200, Stefano Brivio wrote:
> Otherwise, if the current PID has fewer digits than a previously
> written one, the content will be wrong.
> 
> Signed-off-by: Stefano Brivio <sbrivio(a)redhat.com>

Reviewed-by: David Gibson <david(a)gibson.dropbear.id.au>

> ---
>  passt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/passt.c b/passt.c
> index a8d94b4..01eed1b 100644
> --- a/passt.c
> +++ b/passt.c
> @@ -390,7 +390,7 @@ int main(int argc, char **argv)
>  
>  	if (*c.pid_file) {
>  		if ((pidfile_fd = open(c.pid_file,
> -				       O_CREAT | O_WRONLY | O_CLOEXEC,
> +				       O_CREAT | O_TRUNC | O_WRONLY | O_CLOEXEC,
>  				       S_IRUSR | S_IWUSR)) < 0) {
>  			perror("PID file open");
>  			exit(EXIT_FAILURE);

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2022-07-23  2:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 17:42 [PATCH] passt: Truncate PID file on open() Stefano Brivio
2022-07-23  2:27 ` David Gibson [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=YttcjZrOOWx7gh29@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).