From 9133bc1bcc5d122ad85d4f37545ea1e2f32d6048 Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Tue, 10 Dec 2024 21:19:17 +0100
Subject: [PATCH] openat-die: Fix a gcc -Wformat -Wformat-security warning.

* lib/openat-die.c (openat_save_fail, openat_restore_fail): Put the
internationalized error message into non-format-string position.
---
 ChangeLog        | 8 +++++++-
 lib/openat-die.c | 4 ++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5bfb71b28d..f558a22d4d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
-2024-05-12  Simon Josefsson  <simon@josefsson.org>
+2024-12-10  Bruno Haible  <bruno@clisp.org>
+
+	openat-die: Fix a gcc -Wformat -Wformat-security warning.
+	* lib/openat-die.c (openat_save_fail, openat_restore_fail): Put the
+	internationalized error message into non-format-string position.
+
+2024-12-10  Simon Josefsson  <simon@josefsson.org>
 
 	announce-gen: Mention git commit and tag in announcement.
 	* build-aux/announce-gen (this_commit_hash): New variable.
diff --git a/lib/openat-die.c b/lib/openat-die.c
index 403ca4ff7c..022109b433 100644
--- a/lib/openat-die.c
+++ b/lib/openat-die.c
@@ -34,7 +34,7 @@ _Noreturn void
 openat_save_fail (int errnum)
 {
 #ifndef GNULIB_LIBPOSIX
-  error (exit_failure, errnum,
+  error (exit_failure, errnum, "%s",
          _("unable to record current working directory"));
 #endif
   /* _Noreturn cannot be applied to error, since it returns
@@ -53,7 +53,7 @@ _Noreturn void
 openat_restore_fail (int errnum)
 {
 #ifndef GNULIB_LIBPOSIX
-  error (exit_failure, errnum,
+  error (exit_failure, errnum, "%s",
          _("failed to return to initial working directory"));
 #endif
 
-- 
2.39.5