Preserve errno when using g_set_error with _() and g_strerror()
authorChristian Persch <chpe@gnome.org>
Tue, 27 May 2008 21:44:35 +0000 (23:44 +0200)
committerAlexander Larsson <alexl@redhat.com>
Wed, 20 May 2009 11:47:55 +0000 (13:47 +0200)
gio/glocalfileoutputstream.c
glib/gspawn.c

index 03b54e3e87299d1b75a07b11733d076cb3e3e516..5cc40954c8f97dd859dc5f61578ebe5bfd488dc9 100644 (file)
@@ -303,7 +303,7 @@ _g_local_file_output_stream_really_close (GLocalFileOutputStream *file,
           int errsv = errno;
 
          g_set_error (error, G_IO_ERROR,
-                      g_io_error_from_errno (errno),
+                      g_io_error_from_errno (errsv),
                       _("Error renaming temporary file: %s"),
                       g_strerror (errsv));
          goto err_out;
index b566331431c87f701523ce5de29b20dd303a7f67..406ef2b4be0ea3d50e9599535a44c70da4e5d340 100644 (file)
@@ -1462,11 +1462,12 @@ make_pipe (gint     p[2],
 {
   if (pipe (p) < 0)
     {
+      gint errsv = errno;
       g_set_error (error,
                    G_SPAWN_ERROR,
                    G_SPAWN_ERROR_FAILED,
                    _("Failed to create pipe for communicating with child process (%s)"),
-                   g_strerror (errno));
+                   g_strerror (errsv));
       return FALSE;
     }
   else