glib r7565 - in trunk: . glib
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: glib r7565 - in trunk: . glib
- Date: Tue, 30 Sep 2008 20:40:31 +0000 (UTC)
Author: behdad
Date: Tue Sep 30 20:40:31 2008
New Revision: 7565
URL: http://svn.gnome.org/viewvc/glib?rev=7565&view=rev
Log:
2008-09-30 Behdad Esfahbod <behdad gnome org>
Bug 554092 â glib doesn't return G_FILE_ERROR_NOENT et al on OS X
* glib/giounix.c (g_io_unix_read), (g_io_unix_write),
(g_io_unix_seek), (g_io_unix_close), (g_io_unix_set_flags),
(g_io_unix_get_flags), (g_io_channel_new_file):
Like mclasen says: "well, thats the way errno works...,
save it or loose it". Save errno.
Modified:
trunk/ChangeLog
trunk/glib/giounix.c
Modified: trunk/glib/giounix.c
==============================================================================
--- trunk/glib/giounix.c (original)
+++ trunk/glib/giounix.c Tue Sep 30 20:40:31 2008
@@ -190,9 +190,10 @@
if (result < 0)
{
+ int err = errno;
*bytes_read = 0;
- switch (errno)
+ switch (err)
{
#ifdef EINTR
case EINTR:
@@ -204,8 +205,8 @@
#endif
default:
g_set_error_literal (err, G_IO_CHANNEL_ERROR,
- g_io_channel_error_from_errno (errno),
- g_strerror (errno));
+ g_io_channel_error_from_errno (err),
+ g_strerror (err));
return G_IO_STATUS_ERROR;
}
}
@@ -230,9 +231,10 @@
if (result < 0)
{
+ int err = errno;
*bytes_written = 0;
- switch (errno)
+ switch (err)
{
#ifdef EINTR
case EINTR:
@@ -244,8 +246,8 @@
#endif
default:
g_set_error_literal (err, G_IO_CHANNEL_ERROR,
- g_io_channel_error_from_errno (errno),
- g_strerror (errno));
+ g_io_channel_error_from_errno (err),
+ g_strerror (err));
return G_IO_STATUS_ERROR;
}
}
@@ -295,9 +297,10 @@
if (result < 0)
{
+ int err = errno;
g_set_error_literal (err, G_IO_CHANNEL_ERROR,
- g_io_channel_error_from_errno (errno),
- g_strerror (errno));
+ g_io_channel_error_from_errno (err),
+ g_strerror (err));
return G_IO_STATUS_ERROR;
}
@@ -313,9 +316,10 @@
if (close (unix_channel->fd) < 0)
{
+ int err = errno;
g_set_error_literal (err, G_IO_CHANNEL_ERROR,
- g_io_channel_error_from_errno (errno),
- g_strerror (errno));
+ g_io_channel_error_from_errno (err),
+ g_strerror (err));
return G_IO_STATUS_ERROR;
}
@@ -376,9 +380,10 @@
if (fcntl (unix_channel->fd, F_SETFL, fcntl_flags) == -1)
{
+ int err = errno;
g_set_error_literal (err, G_IO_CHANNEL_ERROR,
- g_io_channel_error_from_errno (errno),
- g_strerror (errno));
+ g_io_channel_error_from_errno (err),
+ g_strerror (err));
return G_IO_STATUS_ERROR;
}
@@ -396,8 +401,9 @@
if (fcntl_flags == -1)
{
+ int err = errno;
g_warning (G_STRLOC "Error while getting flags for FD: %s (%d)\n",
- g_strerror (errno), errno);
+ g_strerror (err), err);
return 0;
}
@@ -512,18 +518,20 @@
fid = open (filename, flags, create_mode);
if (fid == -1)
{
+ int err = errno;
g_set_error_literal (error, G_FILE_ERROR,
- g_file_error_from_errno (errno),
- g_strerror (errno));
+ g_file_error_from_errno (err),
+ g_strerror (err));
return (GIOChannel *)NULL;
}
if (fstat (fid, &buffer) == -1) /* In case someone opens a FIFO */
{
+ int err = errno;
close (fid);
g_set_error_literal (error, G_FILE_ERROR,
- g_file_error_from_errno (errno),
- g_strerror (errno));
+ g_file_error_from_errno (err),
+ g_strerror (err));
return (GIOChannel *)NULL;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]