[glib] gio: Use g_strerror() instead of strerror()



commit 18f8b77c04be373fd4f65560519ab0e09596801e
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jun 20 14:58:14 2017 +0100

    gio: Use g_strerror() instead of strerror()
    
    This marginally improves thread safety, and marginally improves
    consistency.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733821

 gio/gdbusauthmechanismsha1.c     |   12 ++++++------
 gio/gdbusmessage.c               |    2 +-
 gio/gdbusserver.c                |    2 +-
 gio/gtestdbus.c                  |    4 ++--
 gio/gunixconnection.c            |    6 +++---
 gio/tests/gdbus-peer.c           |    2 +-
 gio/tests/gsubprocess-testprog.c |    2 +-
 7 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/gio/gdbusauthmechanismsha1.c b/gio/gdbusauthmechanismsha1.c
index d4ebe35..0b17b90 100644
--- a/gio/gdbusauthmechanismsha1.c
+++ b/gio/gdbusauthmechanismsha1.c
@@ -260,7 +260,7 @@ ensure_keyring_directory (GError **error)
                            g_io_error_from_errno (errno),
                            _("Error when getting information for directory “%s”: %s"),
                            path,
-                           strerror (errno));
+                           g_strerror (errno));
               g_free (path);
               path = NULL;
               goto out;
@@ -293,7 +293,7 @@ ensure_keyring_directory (GError **error)
                    g_io_error_from_errno (errno),
                    _("Error creating directory “%s”: %s"),
                    path,
-                   strerror (errno));
+                   g_strerror (errno));
       g_free (path);
       path = NULL;
       goto out;
@@ -531,7 +531,7 @@ keyring_acquire_lock (const gchar  *path,
                            g_io_error_from_errno (errno),
                            _("Error deleting stale lock file “%s”: %s"),
                            lock,
-                           strerror (errno));
+                           g_strerror (errno));
               goto out;
             }
           _log ("Deleted stale lock file '%s'", lock);
@@ -563,7 +563,7 @@ keyring_acquire_lock (const gchar  *path,
                    g_io_error_from_errno (errno),
                    _("Error creating lock file “%s”: %s"),
                    lock,
-                   strerror (errno));
+                   g_strerror (errno));
       goto out;
     }
 
@@ -593,7 +593,7 @@ keyring_release_lock (const gchar  *path,
                    g_io_error_from_errno (errno),
                    _("Error closing (unlinked) lock file “%s”: %s"),
                    lock,
-                   strerror (errno));
+                   g_strerror (errno));
       goto out;
     }
   if (g_unlink (lock) != 0)
@@ -603,7 +603,7 @@ keyring_release_lock (const gchar  *path,
                    g_io_error_from_errno (errno),
                    _("Error unlinking lock file “%s”: %s"),
                    lock,
-                   strerror (errno));
+                   g_strerror (errno));
       goto out;
     }
 
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index ce655ed..9158858 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -3504,7 +3504,7 @@ g_dbus_message_print (GDBusMessage *message,
                 }
               else
                 {
-                  g_string_append_printf (fs, "(fstat failed: %s)", strerror (errno));
+                  g_string_append_printf (fs, "(fstat failed: %s)", g_strerror (errno));
                 }
               g_string_append_printf (str, "%*s  fd %d: %s\n", indent, "", fds[n], fs->str);
               g_string_free (fs, TRUE);
diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c
index bb1b9e2..20df4e2 100644
--- a/gio/gdbusserver.c
+++ b/gio/gdbusserver.c
@@ -872,7 +872,7 @@ try_tcp (GDBusServer  *server,
                            g_io_error_from_errno (errno),
                            _("Error writing nonce file at “%s”: %s"),
                            server->nonce_file,
-                           strerror (errno));
+                           g_strerror (errno));
               goto out;
             }
           bytes_written += ret;
diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c
index 6096052..f10d33c 100644
--- a/gio/gtestdbus.c
+++ b/gio/gtestdbus.c
@@ -245,14 +245,14 @@ watcher_init (void)
       /* fork a child to clean up when we are killed */
       if (pipe (pipe_fds) != 0)
         {
-          g_warning ("pipe() failed: %s", strerror (errno));
+          g_warning ("pipe() failed: %s", g_strerror (errno));
           g_assert_not_reached ();
         }
 
       switch (fork ())
         {
         case -1:
-          g_warning ("fork() failed: %s", strerror (errno));
+          g_warning ("fork() failed: %s", g_strerror (errno));
           g_assert_not_reached ();
           break;
 
diff --git a/gio/gunixconnection.c b/gio/gunixconnection.c
index 1647d36..5f969fd 100644
--- a/gio/gunixconnection.c
+++ b/gio/gunixconnection.c
@@ -501,7 +501,7 @@ g_unix_connection_receive_credentials (GUnixConnection      *connection,
                      G_IO_ERROR,
                      g_io_error_from_errno (errno),
                      _("Error checking if SO_PASSCRED is enabled for socket: %s"),
-                     strerror (errno));
+                     g_strerror (errno));
         goto out;
       }
     if (opt_val == 0)
@@ -516,7 +516,7 @@ g_unix_connection_receive_credentials (GUnixConnection      *connection,
                          G_IO_ERROR,
                          g_io_error_from_errno (errno),
                          _("Error enabling SO_PASSCRED: %s"),
-                         strerror (errno));
+                         g_strerror (errno));
             goto out;
           }
         turn_off_so_passcreds = TRUE;
@@ -609,7 +609,7 @@ g_unix_connection_receive_credentials (GUnixConnection      *connection,
                        G_IO_ERROR,
                        g_io_error_from_errno (errno),
                        _("Error while disabling SO_PASSCRED: %s"),
-                       strerror (errno));
+                       g_strerror (errno));
           goto out;
         }
     }
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index 845eb36..8737ee8 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -626,7 +626,7 @@ read_all_from_fd (gint fd, gsize *out_len, GError **error)
                        "Failed reading %d bytes into offset %d: %s",
                        (gint) sizeof (buf),
                        (gint) str->len,
-                       strerror (errno));
+                       g_strerror (errno));
           goto error;
         }
       else if (num_read > 0)
diff --git a/gio/tests/gsubprocess-testprog.c b/gio/tests/gsubprocess-testprog.c
index 7457246..ca2a6ba 100644
--- a/gio/tests/gsubprocess-testprog.c
+++ b/gio/tests/gsubprocess-testprog.c
@@ -25,7 +25,7 @@ write_all (int           fd,
       gssize bytes_written = write (fd, buf, len);
       if (bytes_written < 0)
        g_error ("Failed to write to fd %d: %s",
-                fd, strerror (errno));
+                fd, g_strerror (errno));
       buf += bytes_written;
       len -= bytes_written;
     }


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