Blob Blame History Raw
From 987a0bd2cd1dcf19a2caefcfc84df48d28149d66 Mon Sep 17 00:00:00 2001
From: Ingo Blechschmidt <iblech@speicherleck.de>
Date: Sat, 2 Apr 2022 16:46:52 +0200
Subject: [PATCH 5/5] Unbreak the build on modern gcc -Werror=format-security

(cherry picked from commit d25051eb6228c885e779a9674f8ee3979da30663)
---
 src/lua.cc  |  4 ++--
 src/main.cc | 12 ++++++------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/lua.cc b/src/lua.cc
index fae997794f49..8f6c711d0037 100644
--- a/src/lua.cc
+++ b/src/lua.cc
@@ -3894,14 +3894,14 @@ void CheckedDoFile (lua_State *L, GameFS * fs, std::string const& fname)
     if (!fs->findFile(fname, completefn))
     {
         fprintf(stderr, _("Cannot find '%s'.\n"), fname.c_str());
-        fprintf(stderr, _("Your installation may be incomplete or invalid.\n"));
+        fprintf(stderr, "%s", _("Your installation may be incomplete or invalid.\n"));
         exit (1);
     }
 
     lua::Error status = lua::DoAbsoluteFile(L, completefn);
     if (status != lua::NO_LUAERROR) {
         fprintf(stderr, _("There was an error loading '%s'.\n"), completefn.c_str());
-        fprintf(stderr, _("Your installation may be incomplete or invalid.\n"));
+        fprintf(stderr, "%s", _("Your installation may be incomplete or invalid.\n"));
         fprintf(stderr, _("Error: '%s'\n"), lua::LastError(L).c_str());
         exit (1);
     }
diff --git a/src/main.cc b/src/main.cc
index 28a1a12b02a3..85e4430f85ba 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -352,7 +352,7 @@ void Application::init(int argc, char **argv)
 
     // initialize preferences -- needs LUA, XML
     if (!options::Load()) {
-        fprintf(stderr, _("Error in configuration file.\n"));
+        fprintf(stderr, "%s", _("Error in configuration file.\n"));
       	fprintf(stderr, "%s\n", lua::LastError (lua::GlobalState()).c_str());
     }
     prefs = PreferenceManager::instance();
@@ -593,7 +593,7 @@ void Application::initSysDatapaths(const std::string &prefFilename)
         if (!ecl::FolderExists(prefPath))
             // may happen on Windows
             if(!ecl::FolderCreate(prefPath)) {
-                fprintf(stderr, _("Error: Home directory does not exist.\n"));
+                fprintf(stderr, "%s", _("Error: Home directory does not exist.\n"));
                 exit(1);
             }
 #ifdef MACOSX
@@ -608,7 +608,7 @@ void Application::initSysDatapaths(const std::string &prefFilename)
         if (!ecl::FolderExists(winAppDataPath))
             // may happen on Windows
             if(!ecl::FolderCreate(winAppDataPath)) {
-                fprintf(stderr, _("Error: Application Data directory does not exist.\n"));
+                fprintf(stderr, "%s", _("Error: Application Data directory does not exist.\n"));
                 exit(1);
             }
 //        Log << "winAppDataPath " << winAppDataPath << "\n";
@@ -616,7 +616,7 @@ void Application::initSysDatapaths(const std::string &prefFilename)
         prefPath = winAppDataPath + ecl::PathSeparator + "." + prefFilename;
 #endif
     } else {
-        fprintf(stderr, _("Error: Home directory does not exist.\n"));
+        fprintf(stderr, "%s", _("Error: Home directory does not exist.\n"));
         exit(1);
     }
 }
@@ -635,7 +635,7 @@ void Application::initXerces() {
                 makeNewTranscoderFor(XMLRecognizer::UTF_8, initResult,
                 4096); // the block size is irrelevant for utf-8
         if (initResult != XMLTransService::Ok) {
-            fprintf(stderr, _("Error in XML initialization.\n"));
+            fprintf(stderr, "%s", _("Error in XML initialization.\n"));
             exit(1);
         }
 
@@ -684,7 +684,7 @@ void Application::initXerces() {
 #endif
     }
     catch (...) {
-        fprintf(stderr, _("Error in XML initialization.\n"));
+        fprintf(stderr, "%s", _("Error in XML initialization.\n"));
         exit(1);
     }
 }
-- 
2.39.1