diff options
author | Christian Persch <chpe@src.gnome.org> | 2008-02-06 15:10:08 +0000 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2008-02-06 15:10:08 +0000 |
commit | 37ac644bd18168330f43f4d52be7e3cbb3415415 (patch) | |
tree | 5114114502a1a51ecc31e6c70df44bac7d949787 /gio/gunixinputstream.c | |
parent | d87c1c0af459673ae515db95dfd283f2fa32b142 (diff) |
Save errno before calling other funcs that potentially alter it. Bug
* gio/gdesktopappinfo.c: (ensure_dir):
* gio/glocalfile.c: (g_local_file_query_filesystem_info),
(g_local_file_read), (g_local_file_delete), (g_local_file_trash),
(g_local_file_move):
* gio/glocalfileinfo.c: (set_xattr), (_g_local_file_info_get),
(_g_local_file_info_get_from_fd), (set_unix_mode),
(set_unix_uid_gid), (set_symlink), (set_mtime_atime):
* gio/glocalfileinputstream.c: (g_local_file_input_stream_read),
(g_local_file_input_stream_skip),
(g_local_file_input_stream_close),
(g_local_file_input_stream_seek):
* gio/glocalfileoutputstream.c:
(g_local_file_output_stream_write),
(g_local_file_output_stream_close),
(g_local_file_output_stream_seek),
(g_local_file_output_stream_truncate), (copy_file_data),
(handle_overwrite_open):
* gio/gunixinputstream.c: (g_unix_input_stream_read),
(g_unix_input_stream_close), (read_async_cb), (close_async_cb):
* gio/gunixoutputstream.c: (g_unix_output_stream_write),
(g_unix_output_stream_close), (write_async_cb), (close_async_cb):
Save
errno before calling other funcs that potentially alter it. Bug
#514766.
svn path=/trunk/; revision=6466
Diffstat (limited to 'gio/gunixinputstream.c')
-rw-r--r-- | gio/gunixinputstream.c | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/gio/gunixinputstream.c b/gio/gunixinputstream.c index ab47ec680..0f58a1d3e 100644 --- a/gio/gunixinputstream.c +++ b/gio/gunixinputstream.c @@ -195,10 +195,12 @@ g_unix_input_stream_read (GInputStream *stream, if (poll_ret == -1) { + int errsv = errno; + g_set_error (error, G_IO_ERROR, - g_io_error_from_errno (errno), + g_io_error_from_errno (errsv), _("Error reading from unix: %s"), - g_strerror (errno)); + g_strerror (errsv)); return -1; } } @@ -210,13 +212,15 @@ g_unix_input_stream_read (GInputStream *stream, res = read (unix_stream->priv->fd, buffer, count); if (res == -1) { - if (errno == EINTR) + int errsv = errno; + + if (errsv == EINTR) continue; g_set_error (error, G_IO_ERROR, - g_io_error_from_errno (errno), + g_io_error_from_errno (errsv), _("Error reading from unix: %s"), - g_strerror (errno)); + g_strerror (errsv)); } break; @@ -243,10 +247,14 @@ g_unix_input_stream_close (GInputStream *stream, /* This might block during the close. Doesn't seem to be a way to avoid it though. */ res = close (unix_stream->priv->fd); if (res == -1) - g_set_error (error, G_IO_ERROR, - g_io_error_from_errno (errno), - _("Error closing unix: %s"), - g_strerror (errno)); + { + int errsv = errno; + + g_set_error (error, G_IO_ERROR, + g_io_error_from_errno (errsv), + _("Error closing unix: %s"), + g_strerror (errsv)); + } break; } @@ -282,13 +290,15 @@ read_async_cb (ReadAsyncData *data, count_read = read (data->stream->priv->fd, data->buffer, data->count); if (count_read == -1) { - if (errno == EINTR) + int errsv = errno; + + if (errsv == EINTR) continue; g_set_error (&error, G_IO_ERROR, - g_io_error_from_errno (errno), + g_io_error_from_errno (errsv), _("Error reading from unix: %s"), - g_strerror (errno)); + g_strerror (errsv)); } break; } @@ -419,10 +429,14 @@ close_async_cb (CloseAsyncData *data) { res = close (unix_stream->priv->fd); if (res == -1) - g_set_error (&error, G_IO_ERROR, - g_io_error_from_errno (errno), - _("Error closing unix: %s"), - g_strerror (errno)); + { + int errsv = errno; + + g_set_error (&error, G_IO_ERROR, + g_io_error_from_errno (errsv), + _("Error closing unix: %s"), + g_strerror (errsv)); + } break; } |