From d7eda08d22ac0f36f08e613c5804d4211687f542 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 17 Dec 2024 18:21:03 +0100 Subject: [PATCH] xstdopen: Improve error message. * lib/xstdopen.c (xstdopen): Improve error message. Ignore the errno value. --- ChangeLog | 6 ++++++ lib/xstdopen.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c2fdf3722f..61ba02f328 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-12-17 Bruno Haible + + xstdopen: Improve error message. + * lib/xstdopen.c (xstdopen): Improve error message. Ignore the errno + value. + 2024-12-10 Bruno Haible openat-die: Fix a gcc -Wformat -Wformat-security warning. diff --git a/lib/xstdopen.c b/lib/xstdopen.c index 3d15c261c5..2c691f5912 100644 --- a/lib/xstdopen.c +++ b/lib/xstdopen.c @@ -31,5 +31,9 @@ xstdopen (void) { int stdopen_errno = stdopen (); if (stdopen_errno != 0) - error (exit_failure, stdopen_errno, _("standard file descriptors")); + /* Ignore stdopen_errno in the error message, since it may be misleading + (see stdopen.c). */ + error (exit_failure, 0, + _("failed to open all three standard file descriptors; maybe %s or %s are not working right?"), + "/dev/null", "/dev/full"); } -- 2.39.5