[gtk+/gtk-2-16] Preserve errno, and always use g_strerror()
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-16] Preserve errno, and always use g_strerror()
- Date: Sat, 29 Aug 2009 02:44:07 +0000 (UTC)
commit e9f8e452cddb9de8e5912f1c03cf47c0f76774fa
Author: Christian Persch <chpe gnome org>
Date: Thu Aug 20 15:32:22 2009 +0200
Preserve errno, and always use g_strerror()
Bug #592461.
gdk-pixbuf/io-gif.c | 2 +-
gtk/gtkfilesel.c | 12 +++++++++---
gtk/updateiconcache.c | 18 +++++++++++++-----
3 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
index 0a5803f..04fb1d1 100644
--- a/gdk-pixbuf/io-gif.c
+++ b/gdk-pixbuf/io-gif.c
@@ -220,7 +220,7 @@ gif_read (GifContext *context, guchar *buffer, size_t len)
G_FILE_ERROR,
g_file_error_from_errno (save_errno),
_("Failure reading GIF: %s"),
- strerror (save_errno));
+ g_strerror (save_errno));
}
#ifdef IO_GIFDEBUG
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index 0aa9f17..eca76ca 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -1355,8 +1355,10 @@ gtk_file_selection_create_dir_confirmed (GtkWidget *widget,
if (g_mkdir (sys_full_path, 0777) < 0)
{
+ int errsv = errno;
+
buf = g_strdup_printf (_("Error creating folder '%s': %s"),
- dirname, g_strerror (errno));
+ dirname, g_strerror (errsv));
gtk_file_selection_fileop_error (fs, buf);
}
@@ -1484,8 +1486,10 @@ gtk_file_selection_delete_file_response (GtkDialog *dialog,
if (g_unlink (sys_full_path) < 0)
{
+ int errsv = errno;
+
buf = g_strdup_printf (_("Error deleting file '%s': %s"),
- fs->fileop_file, g_strerror (errno));
+ fs->fileop_file, g_strerror (errsv));
gtk_file_selection_fileop_error (fs, buf);
}
@@ -1602,9 +1606,11 @@ gtk_file_selection_rename_file_confirmed (GtkWidget *widget,
if (g_rename (sys_old_filename, sys_new_filename) < 0)
{
+ int errsv = errno;
+
buf = g_strdup_printf (_("Error renaming file \"%s\" to \"%s\": %s"),
sys_old_filename, sys_new_filename,
- g_strerror (errno));
+ g_strerror (errsv));
gtk_file_selection_fileop_error (fs, buf);
goto out2;
}
diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c
index f6a5cff..2295d24 100644
--- a/gtk/updateiconcache.c
+++ b/gtk/updateiconcache.c
@@ -1516,9 +1516,11 @@ opentmp:
g_unlink (bak_cache_path);
if (g_rename (cache_path, bak_cache_path) == -1)
{
+ int errsv = errno;
+
g_printerr (_("Could not rename %s to %s: %s, removing %s then.\n"),
cache_path, bak_cache_path,
- g_strerror (errno),
+ g_strerror (errsv),
cache_path);
g_unlink (cache_path);
bak_cache_path = NULL;
@@ -1528,16 +1530,22 @@ opentmp:
if (g_rename (tmp_cache_path, cache_path) == -1)
{
+ int errsv = errno;
+
g_printerr (_("Could not rename %s to %s: %s\n"),
tmp_cache_path, cache_path,
- g_strerror (errno));
+ g_strerror (errsv));
g_unlink (tmp_cache_path);
#ifdef G_OS_WIN32
if (bak_cache_path != NULL)
if (g_rename (bak_cache_path, cache_path) == -1)
- g_printerr (_("Could not rename %s back to %s: %s.\n"),
- bak_cache_path, cache_path,
- g_strerror (errno));
+ {
+ errsv = errno;
+
+ g_printerr (_("Could not rename %s back to %s: %s.\n"),
+ bak_cache_path, cache_path,
+ g_strerror (errsv));
+ }
#endif
exit (1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]