From 0ed8b94bfeb7a974c0e239ddc5396e7b8216f0e5 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 25 Sep 2008 08:05:41 +0000 Subject: [PATCH] Just ignore the child_setup function, never call it. The is no situation 2008-09-25 Tor Lillqvist * 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 --- ChangeLog | 10 ++++++++++ glib/gspawn-win32.c | 16 ++-------------- glib/gspawn.c | 12 ++++++------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 553f746e..38ae0638 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-09-25 Tor Lillqvist + + * 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 Be a little more explcit in the docs. Includes Owen's requested diff --git a/glib/gspawn-win32.c b/glib/gspawn-win32.c index 17278859..ba7970bb 100644 --- a/glib/gspawn-win32.c +++ b/glib/gspawn-win32.c @@ -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, diff --git a/glib/gspawn.c b/glib/gspawn.c index 4c45eaf7..3f5231b7 100644 --- a/glib/gspawn.c +++ b/glib/gspawn.c @@ -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 -- 2.34.1