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
This commit is contained in:
Philip Withnall 2017-06-20 14:58:14 +01:00
parent c8e268bbce
commit 18f8b77c04
7 changed files with 15 additions and 15 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
}

View File

@ -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)

View File

@ -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;
}