From af866931b67be4a13ae4c6e2b836b7a11ca26346 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 6 Oct 2008 22:57:49 +0000 Subject: [PATCH] =?utf8?q?Bug=20555309=20=E2=80=93=20giochannel=20breaks?= =?utf8?q?=20on=20error=20Patch=20from=20Christian=20Persch?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 2008-10-06 Behdad Esfahbod Bug 555309 – giochannel breaks on error Patch from Christian Persch * glib/giounix.c (g_io_unix_read), (g_io_unix_write), (g_io_unix_seek), (g_io_unix_close), (g_io_unix_set_flags): Don't shadow err. Oops! svn path=/trunk/; revision=7574 --- ChangeLog | 9 +++++++++ glib/giounix.c | 34 +++++++++++++++++----------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index d21b0c7..3d36e20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-10-06 Behdad Esfahbod + + Bug 555309 – giochannel breaks on error + Patch from Christian Persch + + * glib/giounix.c (g_io_unix_read), (g_io_unix_write), + (g_io_unix_seek), (g_io_unix_close), (g_io_unix_set_flags): + Don't shadow err. Oops! + 2008-10-06 Christophe Fergeau Bug 555224 – Improve g_format_size_for_display doc diff --git a/glib/giounix.c b/glib/giounix.c index 8045910..eaff939 100644 --- a/glib/giounix.c +++ b/glib/giounix.c @@ -190,10 +190,10 @@ g_io_unix_read (GIOChannel *channel, if (result < 0) { - int err = errno; + int errsv = errno; *bytes_read = 0; - switch (err) + switch (errsv) { #ifdef EINTR case EINTR: @@ -205,8 +205,8 @@ g_io_unix_read (GIOChannel *channel, #endif default: g_set_error_literal (err, G_IO_CHANNEL_ERROR, - g_io_channel_error_from_errno (err), - g_strerror (err)); + g_io_channel_error_from_errno (errsv), + g_strerror (errsv)); return G_IO_STATUS_ERROR; } } @@ -231,10 +231,10 @@ g_io_unix_write (GIOChannel *channel, if (result < 0) { - int err = errno; + int errsv = errno; *bytes_written = 0; - switch (err) + switch (errsv) { #ifdef EINTR case EINTR: @@ -246,8 +246,8 @@ g_io_unix_write (GIOChannel *channel, #endif default: g_set_error_literal (err, G_IO_CHANNEL_ERROR, - g_io_channel_error_from_errno (err), - g_strerror (err)); + g_io_channel_error_from_errno (errsv), + g_strerror (errsv)); return G_IO_STATUS_ERROR; } } @@ -297,10 +297,10 @@ g_io_unix_seek (GIOChannel *channel, if (result < 0) { - int err = errno; + int errsv = errno; g_set_error_literal (err, G_IO_CHANNEL_ERROR, - g_io_channel_error_from_errno (err), - g_strerror (err)); + g_io_channel_error_from_errno (errsv), + g_strerror (errsv)); return G_IO_STATUS_ERROR; } @@ -316,10 +316,10 @@ g_io_unix_close (GIOChannel *channel, if (close (unix_channel->fd) < 0) { - int err = errno; + int errsv = errno; g_set_error_literal (err, G_IO_CHANNEL_ERROR, - g_io_channel_error_from_errno (err), - g_strerror (err)); + g_io_channel_error_from_errno (errsv), + g_strerror (errsv)); return G_IO_STATUS_ERROR; } @@ -380,10 +380,10 @@ g_io_unix_set_flags (GIOChannel *channel, if (fcntl (unix_channel->fd, F_SETFL, fcntl_flags) == -1) { - int err = errno; + int errsv = errno; g_set_error_literal (err, G_IO_CHANNEL_ERROR, - g_io_channel_error_from_errno (err), - g_strerror (err)); + g_io_channel_error_from_errno (errsv), + g_strerror (errsv)); return G_IO_STATUS_ERROR; } -- 2.7.4