Merge revisions 41043:41641 into this branch
authorDick Porter <dick@acm.org>
Thu, 10 Mar 2005 16:32:45 +0000 (16:32 -0000)
committerDick Porter <dick@acm.org>
Thu, 10 Mar 2005 16:32:45 +0000 (16:32 -0000)
svn path=/branches/dick/io-layer-no-daemon/; revision=41656

mono/io-layer/ChangeLog
mono/io-layer/daemon.c
mono/io-layer/error.c
mono/io-layer/sockets.c

index 125f05a9aa8f68cc27efadde4aa0df34ce8aaf6e..d55ec04fb4a9b8ede98a0cc9f32ca19f8f7cec8e 100644 (file)
@@ -1,3 +1,28 @@
+2005-03-09  Dick Porter  <dick@ximian.com>
+
+       * error.c (_wapi_get_win32_file_error): ENFILE and EMFILE should
+       map to ERROR_TOO_MANY_OPEN_FILES, not ERROR_NO_MORE_FILES.  Fixes
+       bug 72671.
+
+2005-03-09  Dick Porter  <dick@ximian.com>
+
+       * daemon.c (process_process_fork): Initialise the handle data
+       before using it in the error case.  This is probably the error
+       we're working around in the previous change.  Spotted by Taru Jain
+       <tjain@novell.com> and Hemanth Yamijala <YHemanth@novell.com>.
+
+2005-03-07  Dick Porter  <dick@ximian.com>
+
+       * daemon.c: It looks like g_shell_parse_argv() can return
+       argv[0]=NULL somehow, yet still not give an error.  Make sure we
+       don't pass NULL to strrchr(), working around a segfault that
+       showed up on ZLM testing.
+
+2005-03-01 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * sockets.c: translate EINPROGRESS to EWOULDBLOCK in connect. This is
+       the expected error code showed by the test case in bug #73053.
+
 2005-02-18 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * io.c: another leftover.
index e2eca91b3eb4deb6b9a5c3687de93143c2933a38..0f5ad38ab882c7136f58c7e02e21ca1e4594c979 100644 (file)
@@ -1104,6 +1104,16 @@ static void process_process_fork (GIOChannel *channel, ChannelData *channel_data
                cmd=_wapi_handle_scratch_lookup (process_fork.cmd);
                dir=_wapi_handle_scratch_lookup (process_fork.dir);
                env=_wapi_handle_scratch_lookup_string_array (process_fork.env);
+
+               _wapi_lookup_handle (GUINT_TO_POINTER (process_handle),
+                                    WAPI_HANDLE_PROCESS,
+                                    (gpointer *)&process_handle_data,
+                                    NULL);
+
+               _wapi_lookup_handle (GUINT_TO_POINTER (thread_handle),
+                                    WAPI_HANDLE_THREAD,
+                                    (gpointer *)&thread_handle_data,
+                                    NULL);
                
                ret=g_shell_parse_argv (cmd, NULL, &argv, &gerr);
                if(ret==FALSE) {
@@ -1116,16 +1126,6 @@ static void process_process_fork (GIOChannel *channel, ChannelData *channel_data
                        g_message (G_GNUC_PRETTY_FUNCTION ": forking");
 #endif
 
-                       _wapi_lookup_handle (GUINT_TO_POINTER (process_handle),
-                                            WAPI_HANDLE_PROCESS,
-                                            (gpointer *)&process_handle_data,
-                                            NULL);
-
-                       _wapi_lookup_handle (GUINT_TO_POINTER (thread_handle),
-                                            WAPI_HANDLE_THREAD,
-                                            (gpointer *)&thread_handle_data,
-                                            NULL);
-
                        /* Fork, exec cmd with args and optional env,
                         * and return the handles with pid and blank
                         * thread id
@@ -1214,12 +1214,20 @@ static void process_process_fork (GIOChannel *channel, ChannelData *channel_data
 
                /* store process name, based on the last section of the cmd */
                {
-                       char *slash=strrchr (argv[0], '/');
+                       char *slash;
                        
-                       if(slash!=NULL) {
-                               process_handle_data->proc_name=_wapi_handle_scratch_store (slash+1, strlen (slash+1));
+                       /* This should never fail, but it seems it can...
+                        */
+                       if (argv[0] != NULL) {
+                               slash=strrchr (argv[0], '/');
+                       
+                               if(slash!=NULL) {
+                                       process_handle_data->proc_name=_wapi_handle_scratch_store (slash+1, strlen (slash+1));
+                               } else {
+                                       process_handle_data->proc_name=_wapi_handle_scratch_store (argv[0], strlen (argv[0]));
+                               }
                        } else {
-                               process_handle_data->proc_name=_wapi_handle_scratch_store (argv[0], strlen (argv[0]));
+                               process_handle_data->proc_name = _wapi_handle_scratch_store (cmd, strlen(cmd));
                        }
                }
                
index e891246356308f3703da3964aa43188ed00e5990..b7fd03c821d3873724fdba03df500e0fe31b8f20 100644 (file)
@@ -164,7 +164,7 @@ _wapi_get_win32_file_error (gint err)
                break;
        
        case ENFILE: case EMFILE:
-               ret = ERROR_NO_MORE_FILES;
+               ret = ERROR_TOO_MANY_OPEN_FILES;
                break;
 
        case ENOENT: case ENOTDIR:
index 9afc50b529041c92b16acdea72024b23e884f605..e585714a00c6bc34198352087a95f3e26edb07fb 100644 (file)
@@ -339,6 +339,9 @@ int _wapi_connect(guint32 fd, const struct sockaddr *serv_addr,
                           strerror (errnum));
 #endif
                errnum = errno_to_WSA (errnum, __func__);
+               if (errnum == WSAEINPROGRESS)
+                       errnum = WSAEWOULDBLOCK; /* see bug #73053 */
+
                WSASetLastError (errnum);
                
                return(SOCKET_ERROR);