Clang 22 treats format strings more strictly and flags the use of
gettext-translated strings directly as format arguments without an
explicit format specifier as a security issue.
Add "%s" format specifier to properly handle the translated strings.
Fixes errors like:
error: format string is not a string literal (potentially insecure)
[-Werror,-Wformat-security]
* lib/openat-die.c (openat_save_fail):
Shush -Wformat-security with clang compiler.
---
lib/openat-die.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/openat-die.c b/lib/openat-die.c
index d37e399856..f4b3301371 100644
--- a/lib/openat-die.c
+++ b/lib/openat-die.c
@@ -35,7 +35,7 @@ openat_save_fail (int errnum)
{
#ifndef GNULIB_LIBPOSIX
error (exit_failure, errnum,
- _("unable to record current working directory"));
+ "%s", _("unable to record current working directory"));
#endif
/* _Noreturn cannot be applied to error, since it returns
when its first argument is 0. To help compilers understand that this
@@ -54,7 +54,7 @@ openat_restore_fail (int errnum)
{
#ifndef GNULIB_LIBPOSIX
error (exit_failure, errnum,
- _("failed to return to initial working directory"));
+ "%s", _("failed to return to initial working directory"));
#endif
/* As above. */