glib r7540 - in trunk: . glib



Author: tml
Date: Thu Sep 25 08:05:41 2008
New Revision: 7540
URL: http://svn.gnome.org/viewvc/glib?rev=7540&view=rev

Log:
2008-09-25  Tor Lillqvist  <tml novell com>

	* glib/gspawn-win32.c (do_spawn_with_pipes) (do_spawn_directly):
	Just ignore the child_setup function, never call it. The is no
	situation in which it could be useful on Windows. Do print a
	warning, like before.

	* glib/gspawn.c (g_spawn_async_with_pipes): Corresponding change
	in documentation.



Modified:
   trunk/ChangeLog
   trunk/glib/gspawn-win32.c
   trunk/glib/gspawn.c

Modified: trunk/glib/gspawn-win32.c
==============================================================================
--- trunk/glib/gspawn-win32.c	(original)
+++ trunk/glib/gspawn-win32.c	Thu Sep 25 08:05:41 2008
@@ -422,8 +422,6 @@
 		   gchar               **argv,
 		   char                **envp,
 		   char                **protected_argv,
-		   GSpawnChildSetupFunc  child_setup,
-		   gpointer              user_data,
 		   GPid                 *child_handle,
 		   GError              **error)     
 {
@@ -471,9 +469,6 @@
       return FALSE;
     }
 
-  if (child_setup)
-    (* child_setup) (user_data);
-
   if (flags & G_SPAWN_SEARCH_PATH)
     if (wenvp != NULL)
       rc = _wspawnvpe (mode, wargv0, (const wchar_t **) wargv, (const wchar_t **) wenvp);
@@ -524,7 +519,6 @@
 		     char                **envp,
 		     GSpawnFlags           flags,
 		     GSpawnChildSetupFunc  child_setup,
-		     gpointer              user_data,
 		     GPid                 *child_handle,
 		     gint                 *standard_input,
 		     gint                 *standard_output,
@@ -557,7 +551,7 @@
   if (child_setup && !warned_about_child_setup)
     {
       warned_about_child_setup = TRUE;
-      g_warning ("passing a child setup function to the g_spawn functions is pointless and dangerous on Win32");
+      g_warning ("passing a child setup function to the g_spawn functions is pointless on Windows and it is ignored");
     }
 
   argc = protect_argv (argv, &protected_argv);
@@ -573,8 +567,7 @@
       gboolean retval =
 	do_spawn_directly (exit_status, do_return_handle, flags,
 			   argv, envp, protected_argv,
-			   child_setup, user_data, child_handle,
-			   error);
+			   child_handle, error);
       g_strfreev (protected_argv);
       return retval;
     }
@@ -752,9 +745,6 @@
       goto cleanup_and_fail;
     }
 
-  if (child_setup)
-    (* child_setup) (user_data);
-
   whelper = g_utf8_to_utf16 (helper_process, -1, NULL, NULL, NULL);
   g_free (helper_process);
 
@@ -936,7 +926,6 @@
 			    envp,
 			    flags,
 			    child_setup,
-			    user_data,
 			    NULL,
 			    NULL,
 			    standard_output ? &outpipe : NULL,
@@ -1157,7 +1146,6 @@
 			      envp,
 			      flags,
 			      child_setup,
-			      user_data,
 			      child_handle,
 			      standard_input,
 			      standard_output,

Modified: trunk/glib/gspawn.c
==============================================================================
--- trunk/glib/gspawn.c	(original)
+++ trunk/glib/gspawn.c	Thu Sep 25 08:05:41 2008
@@ -542,12 +542,12 @@
  * exec(). That is, @child_setup is called just
  * before calling exec() in the child. Obviously
  * actions taken in this function will only affect the child, not the
- * parent. On Windows, there is no separate fork() and exec()
- * functionality. Child processes are created and run with
- * a single API call, CreateProcess(). @child_setup is
- * called in the parent process just before creating the child
- * process. You should carefully consider what you do in @child_setup
- * if you intend your software to be portable to Windows.
+ * parent.
+ *
+ * On Windows, there is no separate fork() and exec()
+ * functionality. Child processes are created and run with a single
+ * API call, CreateProcess(). There is no sensible thing @child_setup
+ * could be used for on Windows so it is ignored and not called.
  *
  * If non-%NULL, @child_pid will on Unix be filled with the child's
  * process ID. You can use the process ID to send signals to the



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