summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-10-16 06:34:50 +0000
committerHavoc Pennington <hp@redhat.com>2003-10-16 06:34:50 +0000
commit549360bcfaa96dfbcd3ffd73496d96851a6cb856 (patch)
tree2af70a2b07972ef956df6a61a77669adb1547f8e /tools
parent236b360b84c96eed8f43e70b66b8cf5308e53517 (diff)
2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or execute, not both (bus_connections_check_reply): use unlink, not remove_link, as we don't want to free the link; fixes double free mess * dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case where no reply was received * dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock): fix a refcount leak * bus/signals.c (match_rule_matches): add special cases for the bus driver, so you can match on sender/destination for it. * dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if DBUS_PRINT_BACKTRACE is set * dbus/dbus-internals.c: add pid to assertion failure messages * dbus/dbus-connection.c: add message type code to the debug spew * glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want sender=foo not service=foo * dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use DBUS_ACTIVATION_ADDRESS instead * bus/activation.c: set DBUS_SESSION_BUS_ADDRESS, DBUS_SYSTEM_BUS_ADDRESS if appropriate * bus/bus.c (bus_context_new): handle OOM copying bus type into context struct * dbus/dbus-message.c (dbus_message_iter_get_object_path): new function (dbus_message_iter_get_object_path_array): new function (half finished, disabled for the moment) * glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle DBUS_MESSAGE_TYPE_ERROR * tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to avoid redirecting stderr to /dev/null (babysit): close stdin if not doing the "exit_with_session" thing * dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not stdout/stdin, so things don't get confused * bus/system.conf.in: fix to allow replies, I modified .conf instead of .conf.in again.
Diffstat (limited to 'tools')
-rw-r--r--tools/dbus-launch.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/dbus-launch.c b/tools/dbus-launch.c
index dc9dad4..e07141a 100644
--- a/tools/dbus-launch.c
+++ b/tools/dbus-launch.c
@@ -239,7 +239,8 @@ do_write (int fd, const void *buf, size_t count)
goto again;
else
{
- fprintf (stderr, "Failed to write data to pipe!\n");
+ fprintf (stderr, "Failed to write data to pipe! %s\n",
+ strerror (errno));
exit (1); /* give up, we suck */
}
}
@@ -461,6 +462,10 @@ babysit (int exit_with_session,
long val;
char *end;
int dev_null_fd;
+ const char *s;
+
+ verbose ("babysitting, exit_with_session = %d, child_pid = %ld, read_bus_pid_fd = %d, write_bus_pid_fd = %d\n",
+ exit_with_session, (long) child_pid, read_bus_pid_fd, write_bus_pid_fd);
/* We chdir ("/") since we are persistent and daemon-like, and fork
* again so dbus-launch can reap the parent. However, we don't
@@ -476,14 +481,19 @@ babysit (int exit_with_session,
exit (1);
}
- /* Move stdout/stderr so we don't block an "eval" or otherwise
- * lock up.
+ /* Close stdout/stderr so we don't block an "eval" or otherwise
+ * lock up. stdout is still chaining through to dbus-launch
+ * and in turn to the parent shell.
*/
dev_null_fd = open ("/dev/null", O_RDWR);
if (dev_null_fd >= 0)
{
+ if (!exit_with_session)
+ dup2 (dev_null_fd, 0);
dup2 (dev_null_fd, 1);
- dup2 (dev_null_fd, 2);
+ s = getenv ("DBUS_DEBUG_OUTPUT");
+ if (s == NULL || *s == '\0')
+ dup2 (dev_null_fd, 2);
}
else
{
@@ -888,6 +898,11 @@ main (int argc, char **argv)
}
verbose ("dbus-launch exiting\n");
+
+ fflush (stdout);
+ fflush (stderr);
+ close (1);
+ close (2);
exit (0);
}