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
This commit is contained in:
Christian Persch
2008-02-06 15:10:08 +00:00
parent d87c1c0af4
commit 37ac644bd1
8 changed files with 232 additions and 112 deletions

View File

@@ -183,10 +183,12 @@ g_unix_output_stream_write (GOutputStream *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 writing to unix: %s"),
g_strerror (errno));
g_strerror (errsv));
return -1;
}
}
@@ -199,13 +201,15 @@ g_unix_output_stream_write (GOutputStream *stream,
res = write (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 writing to unix: %s"),
g_strerror (errno));
g_strerror (errsv));
}
break;
@@ -233,10 +237,12 @@ g_unix_output_stream_close (GOutputStream *stream,
res = close (unix_stream->priv->fd);
if (res == -1)
{
int errsv = errno;
g_set_error (error, G_IO_ERROR,
g_io_error_from_errno (errno),
g_io_error_from_errno (errsv),
_("Error closing unix: %s"),
g_strerror (errno));
g_strerror (errsv));
}
break;
}
@@ -273,13 +279,15 @@ write_async_cb (WriteAsyncData *data,
count_written = write (data->stream->priv->fd, data->buffer, data->count);
if (count_written == -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;
}
@@ -380,10 +388,12 @@ close_async_cb (CloseAsyncData *data)
res = close (unix_stream->priv->fd);
if (res == -1)
{
int errsv = errno;
g_set_error (&error, G_IO_ERROR,
g_io_error_from_errno (errno),
g_io_error_from_errno (errsv),
_("Error closing unix: %s"),
g_strerror (errno));
g_strerror (errsv));
}
break;
}