diff options
author | Havoc Pennington <hp@redhat.com> | 2007-07-24 22:11:00 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2007-07-24 22:11:00 +0000 |
commit | 79d3004e26f490ef37ae0298495ea66f322ce374 (patch) | |
tree | e42cc442c8e24330a1b1cc5446338befde93e3a6 /dbus | |
parent | 0b5478e49e250a85102ee0bf711609466a9437eb (diff) |
2007-07-24 Havoc Pennington <hp@redhat.com>
* configure.in: add AM_PROG_CC_C_O to allow per-target CPPFLAGS
* bus/dispatch.c (bus_dispatch_test_conf): Fix up setting
TEST_LAUNCH_HELPER_CONFIG to include the full path, and enable
test shell_fail_service_auto_start when use_launcher==TRUE
* bus/activation-helper-bin.c (convert_error_to_exit_code): pass
through the INVALID_ARGS error so the test suite works
* bus/activation.c (handle_activation_exit_error): return
DBUS_ERROR_NO_MEMORY if we get BUS_SPAWN_EXIT_CODE_NO_MEMORY
* dbus/dbus-spawn.c (_dbus_babysitter_get_child_exit_status):
return only the exit code of the child, not the entire thingy from
waitpid(), and make the return value indicate whether the child
exited normally (with a status code)
* bus/bus.c (process_config_first_time_only): _dbus_strdup works
on NULL so no need to check
(process_config_every_time): move servicehelper init here, so we
reload it on HUP or config file change
* bus/Makefile.am (install-data-hook): remove comment because
Emacs make mode seems to be grumpy about it
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-spawn.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/dbus/dbus-spawn.c b/dbus/dbus-spawn.c index 125aea7c..810536fd 100644 --- a/dbus/dbus-spawn.c +++ b/dbus/dbus-spawn.c @@ -417,7 +417,7 @@ read_data (DBusBabysitter *sitter, { sitter->have_child_status = TRUE; sitter->status = arg; - sitter->errnum = WEXITSTATUS (sitter->status); + sitter->errnum = 0; _dbus_verbose ("recorded child status exited = %d signaled = %d exitstatus = %d termsig = %d\n", WIFEXITED (sitter->status), WIFSIGNALED (sitter->status), WEXITSTATUS (sitter->status), WTERMSIG (sitter->status)); @@ -624,26 +624,29 @@ _dbus_babysitter_get_child_exited (DBusBabysitter *sitter) } /** - * Gets the exit status of the child. We do this so implimentation specific - * detail is not cluttering up dbus, for example the system laucher code. + * Gets the exit status of the child. We do this so implementation specific + * detail is not cluttering up dbus, for example the system launcher code. + * This can only be called if the child has exited, i.e. call + * _dbus_babysitter_get_child_exited(). It returns FALSE if the child + * did not return a status code, e.g. because the child was signaled + * or we failed to ever launch the child in the first place. * * @param sitter the babysitter * @param status the returned status code * @returns #FALSE on failure */ dbus_bool_t -_dbus_babysitter_get_child_exit_status (DBusBabysitter *sitter, int *status) +_dbus_babysitter_get_child_exit_status (DBusBabysitter *sitter, + int *status) { if (!_dbus_babysitter_get_child_exited (sitter)) _dbus_assert_not_reached ("Child has not exited"); + + if (!sitter->have_child_status || + !(WIFEXITED (sitter->status))) + return FALSE; - if (sitter->errnum != WEXITSTATUS (sitter->status)) - _dbus_assert_not_reached ("Status is not exit!"); - - if (!sitter->have_child_status) - _dbus_assert_not_reached ("Not a child!"); - - *status = sitter->status; + *status = WEXITSTATUS (sitter->status); return TRUE; } |