[gnome-terminal/gnome-43] all: Replace %m with using g_strerror() in printf calls



commit 18b54d83569cb92756ff7572913a280d0ba3f011
Author: Christian Persch <chpe src gnome org>
Date:   Thu Aug 18 18:32:17 2022 +0200

    all: Replace %m with using g_strerror() in printf calls
    
    ... to be more portable.
    
    (cherry picked from commit fd27fa449c8a494c41fcb0a8c127ffa74725b8be)

 src/server.cc        | 3 ++-
 src/terminal-util.cc | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/server.cc b/src/server.cc
index 83a94729..5d7e4991 100644
--- a/src/server.cc
+++ b/src/server.cc
@@ -161,7 +161,8 @@ init_server (int argc,
   }
 
   if (!increase_rlimit_nofile ()) {
-    g_printerr ("Failed to increase RLIMIT_NOFILE: %m\n");
+    auto const errsv = errno;
+    g_printerr ("Failed to increase RLIMIT_NOFILE: %s\n", g_strerror(errsv));
   }
 
   /* Now we can create the app */
diff --git a/src/terminal-util.cc b/src/terminal-util.cc
index b581cbe4..747737b8 100644
--- a/src/terminal-util.cc
+++ b/src/terminal-util.cc
@@ -1219,8 +1219,10 @@ ensure_cache_dir (void)
   cache_dir = get_cache_dir ();
   errno = 0;
   r = g_mkdir_with_parents (cache_dir, 0700);
-  if (r == -1 && errno != EEXIST)
-    g_printerr ("Failed to create cache dir: %m\n");
+  if (r == -1 && errno != EEXIST) {
+    auto const errsv = errno;
+    g_printerr ("Failed to create cache dir: %s\n", g_strerror(errsv));
+  }
   return r == 0;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]