Author: dick
Date: 2005-03-07 10:26:35 -0500 (Mon, 07 Mar 2005)
New Revision: 41527

Modified:
   trunk/mono/mono/io-layer/ChangeLog
   trunk/mono/mono/io-layer/daemon.c
Log:

2005-03-07  Dick Porter  <[EMAIL PROTECTED]>

        * 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.




Modified: trunk/mono/mono/io-layer/ChangeLog
===================================================================
--- trunk/mono/mono/io-layer/ChangeLog  2005-03-07 14:54:52 UTC (rev 41526)
+++ trunk/mono/mono/io-layer/ChangeLog  2005-03-07 15:26:35 UTC (rev 41527)
@@ -1,3 +1,10 @@
+2005-03-07  Dick Porter  <[EMAIL PROTECTED]>
+
+       * 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 <[EMAIL PROTECTED]>
 
        * sockets.c: translate EINPROGRESS to EWOULDBLOCK in connect. This is

Modified: trunk/mono/mono/io-layer/daemon.c
===================================================================
--- trunk/mono/mono/io-layer/daemon.c   2005-03-07 14:54:52 UTC (rev 41526)
+++ trunk/mono/mono/io-layer/daemon.c   2005-03-07 15:26:35 UTC (rev 41527)
@@ -1214,12 +1214,20 @@
 
                /* 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));
                        }
                }
                

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to