Just ignore the child_setup function, never call it. The is no situation

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.


svn path=/trunk/; revision=7540
This commit is contained in:
Tor Lillqvist 2008-09-25 08:05:41 +00:00 committed by Tor Lillqvist
parent ee685b003e
commit 0ed8b94bfe
3 changed files with 18 additions and 20 deletions

View File

@ -1,3 +1,13 @@
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.
2008-09-24 Sven Herzberg <sven@imendio.com>
Be a little more explcit in the docs. Includes Owen's requested

View File

@ -422,8 +422,6 @@ do_spawn_directly (gint *exit_status,
gchar **argv,
char **envp,
char **protected_argv,
GSpawnChildSetupFunc child_setup,
gpointer user_data,
GPid *child_handle,
GError **error)
{
@ -471,9 +469,6 @@ do_spawn_directly (gint *exit_status,
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 @@ do_spawn_with_pipes (gint *exit_status,
char **envp,
GSpawnFlags flags,
GSpawnChildSetupFunc child_setup,
gpointer user_data,
GPid *child_handle,
gint *standard_input,
gint *standard_output,
@ -557,7 +551,7 @@ do_spawn_with_pipes (gint *exit_status,
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 @@ do_spawn_with_pipes (gint *exit_status,
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 @@ do_spawn_with_pipes (gint *exit_status,
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 @@ g_spawn_sync_utf8 (const gchar *working_directory,
envp,
flags,
child_setup,
user_data,
NULL,
NULL,
standard_output ? &outpipe : NULL,
@ -1157,7 +1146,6 @@ g_spawn_async_with_pipes_utf8 (const gchar *working_directory,
envp,
flags,
child_setup,
user_data,
child_handle,
standard_input,
standard_output,

View File

@ -542,12 +542,12 @@ g_spawn_sync (const gchar *working_directory,
* 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