On Fri, Feb 07, 2025 at 02:29:23AM +0100, Stefano Brivio wrote:
On Fri, 7 Feb 2025 12:15:35 +1100 David Gibson
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
Reviewed-by: David Gibson
--- 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.
Hrm, is the non-locale one really that much code though? Shouldn't it be about 5 lines of code and a table of strings? But then.. glibc is really good at making things complicated. -- David Gibson (he or they) | 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