Prefer g_strerror() to strerror()

It handles encodins better, is thread-safe and more portable.
tingping/wmclass
Sebastian Rasmussen 2016-09-15 00:47:56 +08:00
parent 14a11943bb
commit b21f4bf542
5 changed files with 8 additions and 8 deletions

View File

@ -103,7 +103,7 @@ child_setup (gpointer user_data)
if (unshare (CLONE_NEWUSER))
{
g_warning ("Can't unshare user namespace: %s", strerror (errno));
g_warning ("Can't unshare user namespace: %s", g_strerror (errno));
return;
}
@ -206,7 +206,7 @@ flatpak_builtin_enter (int argc,
{
ns_fd[i] = open (path, O_RDONLY);
if (ns_fd[i] == -1)
return flatpak_fail (error, _("Can't open %s namespace: %s"), ns_name[i], strerror (errno));
return flatpak_fail (error, _("Can't open %s namespace: %s"), ns_name[i], g_strerror (errno));
}
}
@ -215,7 +215,7 @@ flatpak_builtin_enter (int argc,
if (ns_fd[i] != -1)
{
if (setns (ns_fd[i], 0) == -1)
return flatpak_fail (error, _("Can't enter %s namespace: %s"), ns_name[i], strerror (errno));
return flatpak_fail (error, _("Can't enter %s namespace: %s"), ns_name[i], g_strerror (errno));
close (ns_fd[i]);
}
}

View File

@ -2917,7 +2917,7 @@ add_dbus_proxy_args (GPtrArray *argv_array,
{
int errsv = errno;
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (errsv),
_("Failed to open app info file: %s"), strerror (errsv));
_("Failed to open app info file: %s"), g_strerror (errsv));
return FALSE;
}

View File

@ -355,7 +355,7 @@ flatpak_migrate_from_xdg_app (void)
if (errno != ENOENT &&
errno != ENOTEMPTY &&
errno != EEXIST)
g_print ("Error during migration: %s\n", strerror (errno));
g_print ("Error during migration: %s\n", g_strerror (errno));
}
}
}

View File

@ -1378,7 +1378,7 @@ xdp_inode_locked_close_unneeded_fds (XdpInode *inode)
g_debug ("moving %s to %s", inode->trunc_filename, inode->backing_filename);
if (renameat (inode->dir_fd, inode->trunc_filename,
inode->dir_fd, inode->backing_filename) != 0)
g_warning ("Unable to replace truncated document: %s", strerror (errno));
g_warning ("Unable to replace truncated document: %s", g_strerror (errno));
}
inode->truncated = FALSE;

View File

@ -936,9 +936,9 @@ on_name_acquired (GDBusConnection *connection,
if (stat (xdp_fuse_get_mountpoint (), &stbuf) != 0)
{
g_set_error (&exit_error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "fuse stat failed: %s", strerror (errno));
g_set_error (&exit_error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "fuse stat failed: %s", g_strerror (errno));
final_exit_status = 7;
g_printerr ("fuse stat failed: %s", strerror (errno));
g_printerr ("fuse stat failed: %s", g_strerror (errno));
g_main_loop_quit (loop);
return;
}