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



commit fd27fa449c8a494c41fcb0a8c127ffa74725b8be
Author: Christian Persch <chpe src gnome org>
Date:   Thu Aug 18 18:31:01 2022 +0200

    all: Replace %m with using g_strerror() in printf calls
    
    ... to be more portable.

 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]