From dcb78fd43ac846f99289114ac91883c7b2b74788 Mon Sep 17 00:00:00 2001 From: Ron Steinke Date: Sun, 5 Jan 2003 18:11:15 +0000 Subject: [PATCH] (Ancient, binary compatible fixes found sitting in my tree) * Added early checks for count == 0 and buf == NULL in g_io_channel_read() * Better error message for EFAULT in g_io_channel_error_from_errno() --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-12 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ glib/giochannel.c | 11 ++++++++++- 7 files changed, 58 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b4291d2..c43e78b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-01-25 Ron Steinke + + (Ancient, binary compatible fixes found sitting in my tree) + + * Added early checks for count == 0 and buf == NULL in g_io_channel_read() + + * Better error message for EFAULT in g_io_channel_error_from_errno() + 2003-01-04 Tor Lillqvist * Makefile.am (BUILT_EXTRA_DIST): Don't distribute glib-zip. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b4291d2..c43e78b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +2003-01-25 Ron Steinke + + (Ancient, binary compatible fixes found sitting in my tree) + + * Added early checks for count == 0 and buf == NULL in g_io_channel_read() + + * Better error message for EFAULT in g_io_channel_error_from_errno() + 2003-01-04 Tor Lillqvist * Makefile.am (BUILT_EXTRA_DIST): Don't distribute glib-zip. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index b4291d2..c43e78b 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,11 @@ +2003-01-25 Ron Steinke + + (Ancient, binary compatible fixes found sitting in my tree) + + * Added early checks for count == 0 and buf == NULL in g_io_channel_read() + + * Better error message for EFAULT in g_io_channel_error_from_errno() + 2003-01-04 Tor Lillqvist * Makefile.am (BUILT_EXTRA_DIST): Don't distribute glib-zip. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b4291d2..c43e78b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +2003-01-25 Ron Steinke + + (Ancient, binary compatible fixes found sitting in my tree) + + * Added early checks for count == 0 and buf == NULL in g_io_channel_read() + + * Better error message for EFAULT in g_io_channel_error_from_errno() + 2003-01-04 Tor Lillqvist * Makefile.am (BUILT_EXTRA_DIST): Don't distribute glib-zip. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b4291d2..c43e78b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +2003-01-25 Ron Steinke + + (Ancient, binary compatible fixes found sitting in my tree) + + * Added early checks for count == 0 and buf == NULL in g_io_channel_read() + + * Better error message for EFAULT in g_io_channel_error_from_errno() + 2003-01-04 Tor Lillqvist * Makefile.am (BUILT_EXTRA_DIST): Don't distribute glib-zip. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b4291d2..c43e78b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +2003-01-25 Ron Steinke + + (Ancient, binary compatible fixes found sitting in my tree) + + * Added early checks for count == 0 and buf == NULL in g_io_channel_read() + + * Better error message for EFAULT in g_io_channel_error_from_errno() + 2003-01-04 Tor Lillqvist * Makefile.am (BUILT_EXTRA_DIST): Don't distribute glib-zip. diff --git a/glib/giochannel.c b/glib/giochannel.c index 68ed280..2c75a6d 100644 --- a/glib/giochannel.c +++ b/glib/giochannel.c @@ -180,6 +180,15 @@ g_io_channel_read (GIOChannel *channel, g_return_val_if_fail (channel != NULL, G_IO_ERROR_UNKNOWN); g_return_val_if_fail (bytes_read != NULL, G_IO_ERROR_UNKNOWN); + if (count == 0) + { + if (bytes_read) + *bytes_read = 0; + return G_IO_STATUS_NORMAL; + } + + g_return_val_if_fail (buf != NULL, G_IO_ERROR_UNKNOWN); + status = channel->funcs->io_read (channel, buf, count, bytes_read, &err); error = g_io_error_get_from_g_error (status, err); @@ -550,7 +559,7 @@ g_io_channel_error_from_errno (gint en) #ifdef EFAULT case EFAULT: - g_warning("File descriptor outside valid address space.\n"); + g_warning("Buffer outside valid address space.\n"); return G_IO_CHANNEL_ERROR_FAILED; #endif -- 2.7.4