mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-14 12:28:29 +01:00
The documentation for g_spawn_async_with_pipes_and_fds() states: > If an error occurs, child_pid, stdin_pipe_out, stdout_pipe_out, and > stderr_pipe_out will not be filled with valid values. Before2dc3a6f0c8, the `child_pid` argument was `self->pid`, and GObject zero-initializes structs. So the pid field was properly initialized to zero. After2dc3a6f0c8, however, the out variable is now declared inside initable_init(), and it's unitialized. So if g_spawn_async_with_pipes_and_fds() errors out, `pid` will have trash value in it, and the following assertion will fail: ``` g_assert (success == (pid != 0)); ``` Fix that by initializing the `pid` variable to zero. Add a test to exercise the fail code path, and prevent errors like this in the future.
59 KiB
59 KiB