public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] passt-repair: Don't use perror(), accept ECONNRESET as termination
Date: Fri, 7 Feb 2025 02:29:23 +0100	[thread overview]
Message-ID: <20250207022923.74b29ed5@elisabeth> (raw)
In-Reply-To: <Z6Vet3hxxL_LIOHi@zatzit>

On Fri, 7 Feb 2025 12:15:35 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:

> On Fri, Feb 07, 2025 at 01:54:39AM +0100, Stefano Brivio wrote:
> > If we use glibc's perror(), we need to allow dup() and fcntl() in our
> > seccomp profiles, which are a bit too much for this simple helper. On
> > top of that, we would probably need a wrapper to avoid allocation for
> > translated messages.
> > 
> > While at it: ECONNRESET is just a close() from passt, treat it like
> > EOF.
> > 
> > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>  
> 
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> 
> > ---
> >  passt-repair.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/passt-repair.c b/passt-repair.c
> > index 3c3247b..d137a18 100644
> > --- a/passt-repair.c
> > +++ b/passt-repair.c
> > @@ -95,7 +95,7 @@ int main(int argc, char **argv)
> >  	}
> >  
> >  	if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
> > -		perror("Failed to create AF_UNIX socket");
> > +		fprintf(stderr, "Failed to create AF_UNIX socket:
> > %i\n", errno);  
> 
> We could use strerror_() here, couldn't we?

We would need to link that, which is quite some code (the whole 
strerrordesc_np())... I mean, this runs privileged.

-- 
Stefano


  reply	other threads:[~2025-02-07  1:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07  0:54 [PATCH] passt-repair: Don't use perror(), accept ECONNRESET as termination Stefano Brivio
2025-02-07  1:15 ` David Gibson
2025-02-07  1:29   ` Stefano Brivio [this message]
2025-02-07  2:38     ` David Gibson
2025-02-07  9:42       ` Stefano Brivio

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=20250207022923.74b29ed5@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=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).