[gnio] Make sure we correctly return G_IO_ERROR_ADDRESS_IN_USE



commit eade49fce639ff02c15dc8ba2e15f06300e5c80b
Author: Alexander Larsson <alexl redhat com>
Date:   Thu May 7 21:05:55 2009 +0200

    Make sure we correctly return G_IO_ERROR_ADDRESS_IN_USE
    
    This is a very useful error to have a separate error code for, as
    it often happens and should be specially looked for by apps.
---
 gio/gsocket.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/gio/gsocket.c b/gio/gsocket.c
index 4349e29..90d9e50 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -160,10 +160,15 @@ static GIOErrorEnum
 socket_io_error_from_errno (int err)
 {
 #ifndef G_OS_WIN32
+  /* TODO: Move this check to g_io_error_from_errno() */
+  if (err == EADDRINUSE)
+    return G_IO_ERROR_ADDRESS_IN_USE;
   return g_io_error_from_errno (err);
 #else
   switch (err)
     {
+    case WSAEADDRINUSE:
+      return G_IO_ERROR_ADDRESS_IN_USE;
     case WSAEWOULDBLOCK:
       return G_IO_ERROR_WOULD_BLOCK;
     case WSAEACCES:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]