dbus/dbus dbus-bus.c,1.25,1.26 dbus-connection.c,1.70,1.71 dbus-internals.c,1.32,1.33 dbus-internals.h,1.37,1.38 dbus-message.c,1.109,1.110 dbus-message.h,1.45,1.46 dbus-pending-call.c,1.3,1.4 dbus-sysdeps.c,1.66,1.67
Havoc Pennington
hp@pdx.freedesktop.org
Wed, 15 Oct 2003 23:34:53 -0700
Update of /cvs/dbus/dbus/dbus
In directory pdx:/tmp/cvs-serv10532/dbus
Modified Files:
dbus-bus.c dbus-connection.c dbus-internals.c dbus-internals.h
dbus-message.c dbus-message.h dbus-pending-call.c
dbus-sysdeps.c
Log Message:
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.
Index: dbus-bus.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-bus.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- dbus-bus.c 30 Sep 2003 02:32:52 -0000 1.25
+++ dbus-bus.c 16 Oct 2003 06:34:51 -0000 1.26
@@ -143,6 +143,8 @@
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
{
+ _dbus_verbose ("Filling in system bus address...\n");
+
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_SYSTEM],
"DBUS_SYSTEM_BUS_ADDRESS"))
return FALSE;
@@ -154,27 +156,44 @@
_dbus_strdup (DBUS_SYSTEM_BUS_DEFAULT_ADDRESS);
if (bus_connection_addresses[DBUS_BUS_SYSTEM] == NULL)
return FALSE;
+
+ _dbus_verbose (" used default system bus \"%s\"\n",
+ bus_connection_addresses[DBUS_BUS_SYSTEM]);
}
+ else
+ _dbus_verbose (" used env var system bus \"%s\"\n",
+ bus_connection_addresses[DBUS_BUS_SYSTEM]);
}
if (bus_connection_addresses[DBUS_BUS_SESSION] == NULL)
{
+ _dbus_verbose ("Filling in session bus address...\n");
+
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_SESSION],
"DBUS_SESSION_BUS_ADDRESS"))
return FALSE;
+ _dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_SESSION] ?
+ bus_connection_addresses[DBUS_BUS_SESSION] : "none set");
}
if (bus_connection_addresses[DBUS_BUS_ACTIVATION] == NULL)
{
+ _dbus_verbose ("Filling in activation bus address...\n");
+
if (!get_from_env (&bus_connection_addresses[DBUS_BUS_ACTIVATION],
"DBUS_ACTIVATION_ADDRESS"))
return FALSE;
+
+ _dbus_verbose (" \"%s\"\n", bus_connection_addresses[DBUS_BUS_ACTIVATION] ?
+ bus_connection_addresses[DBUS_BUS_ACTIVATION] : "none set");
}
s = _dbus_getenv ("DBUS_ACTIVATION_BUS_TYPE");
if (s != NULL)
{
+ _dbus_verbose ("Bus activation type was set to \"%s\"\n", s);
+
if (strcmp (s, "system") == 0)
activation_bus_type = DBUS_BUS_SYSTEM;
else if (strcmp (s, "session") == 0)
@@ -311,10 +330,12 @@
address_type = type;
/* Use the real type of the activation bus for getting its
- * connection. (If the activating bus isn't a well-known
- * bus then activation_bus_type == DBUS_BUS_ACTIVATION)
+ * connection, but only if the real type's address is available. (If
+ * the activating bus isn't a well-known bus then
+ * activation_bus_type == DBUS_BUS_ACTIVATION)
*/
- if (type == DBUS_BUS_ACTIVATION)
+ if (type == DBUS_BUS_ACTIVATION &&
+ bus_connection_addresses[activation_bus_type] != NULL)
type = activation_bus_type;
if (bus_connections[type] != NULL)
Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- dbus-connection.c 30 Sep 2003 02:32:52 -0000 1.70
+++ dbus-connection.c 16 Oct 2003 06:34:51 -0000 1.71
@@ -344,11 +344,13 @@
_dbus_connection_wakeup_mainloop (connection);
- _dbus_verbose ("Message %p (%s) added to incoming queue %p, %d incoming\n",
+ _dbus_verbose ("Message %p (%d %s '%s') added to incoming queue %p, %d incoming\n",
message,
+ dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
+ dbus_message_get_signature (message),
connection,
connection->n_incoming);
}
@@ -430,11 +432,13 @@
connection->n_outgoing -= 1;
- _dbus_verbose ("Message %p (%s) removed from outgoing queue %p, %d left to send\n",
+ _dbus_verbose ("Message %p (%d %s '%s') removed from outgoing queue %p, %d left to send\n",
message,
+ dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
+ dbus_message_get_signature (message),
connection, connection->n_outgoing);
/* Save this link in the link cache also */
@@ -690,12 +694,20 @@
message = pending->timeout_link->data;
_dbus_list_clear (&pending->timeout_link);
}
+ else
+ dbus_message_ref (message);
- _dbus_verbose (" handing message %p to pending call\n", message);
+ _dbus_verbose (" handing message %p (%s) to pending call serial %u\n",
+ message,
+ dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_METHOD_RETURN ?
+ "method return" :
+ dbus_message_get_type (message) == DBUS_MESSAGE_TYPE_ERROR ?
+ "error" : "other type",
+ pending->reply_serial);
_dbus_assert (pending->reply == NULL);
+ _dbus_assert (pending->reply_serial == dbus_message_get_reply_serial (message));
pending->reply = message;
- dbus_message_ref (pending->reply);
dbus_pending_call_ref (pending); /* in case there's no app with a ref held */
_dbus_connection_detach_pending_call_and_unlock (pending->connection, pending);
@@ -1505,11 +1517,13 @@
connection->n_outgoing += 1;
- _dbus_verbose ("Message %p (%s) added to outgoing queue %p, %d pending to send\n",
+ _dbus_verbose ("Message %p (%d %s '%s') added to outgoing queue %p, %d pending to send\n",
message,
+ dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
+ dbus_message_get_signature (message),
connection,
connection->n_outgoing);
@@ -2178,11 +2192,13 @@
link = _dbus_list_pop_first_link (&connection->incoming_messages);
connection->n_incoming -= 1;
- _dbus_verbose ("Message %p (%s) removed from incoming queue %p, %d incoming\n",
+ _dbus_verbose ("Message %p (%d %s '%s') removed from incoming queue %p, %d incoming\n",
link->data,
+ dbus_message_get_type (link->data),
dbus_message_get_interface (link->data) ?
dbus_message_get_interface (link->data) :
"no interface",
+ dbus_message_get_signature (link->data),
connection, connection->n_incoming);
return link;
@@ -2227,11 +2243,13 @@
message_link);
connection->n_incoming += 1;
- _dbus_verbose ("Message %p (%s) put back into queue %p, %d incoming\n",
+ _dbus_verbose ("Message %p (%d %s '%s') put back into queue %p, %d incoming\n",
message_link->data,
+ dbus_message_get_type (message_link->data),
dbus_message_get_interface (message_link->data) ?
dbus_message_get_interface (message_link->data) :
"no interface",
+ dbus_message_get_signature (message_link->data),
connection, connection->n_incoming);
}
@@ -2558,8 +2576,9 @@
/* We're still protected from dispatch() reentrancy here
* since we acquired the dispatcher
*/
- _dbus_verbose (" running object path dispatch on message %p (%s)\n",
+ _dbus_verbose (" running object path dispatch on message %p (%d %s '%s')\n",
message,
+ dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface");
@@ -2625,15 +2644,19 @@
result = DBUS_HANDLER_RESULT_HANDLED;
}
- _dbus_verbose (" done dispatching %p (%s) on connection %p\n", message,
+ _dbus_verbose (" done dispatching %p (%d %s '%s') on connection %p\n", message,
+ dbus_message_get_type (message),
dbus_message_get_interface (message) ?
dbus_message_get_interface (message) :
"no interface",
+ dbus_message_get_signature (message),
connection);
out:
if (result == DBUS_HANDLER_RESULT_NEED_MEMORY)
{
+ _dbus_verbose ("out of memory in %s\n", _DBUS_FUNCTION_NAME);
+
/* Put message back, and we'll start over.
* Yes this means handlers must be idempotent if they
* don't return HANDLED; c'est la vie.
@@ -2643,6 +2666,8 @@
}
else
{
+ _dbus_verbose ("Done with message in %s\n", _DBUS_FUNCTION_NAME);
+
if (connection->exit_on_disconnect &&
dbus_message_is_signal (message,
DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL,
Index: dbus-internals.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-internals.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- dbus-internals.c 14 Oct 2003 22:16:03 -0000 1.32
+++ dbus-internals.c 16 Oct 2003 06:34:51 -0000 1.33
@@ -223,6 +223,8 @@
va_start (args, format);
vfprintf (stderr, format, args);
va_end (args);
+
+ fflush (stderr);
}
/**
@@ -424,7 +426,7 @@
#ifndef DBUS_DISABLE_CHECKS
/** String used in _dbus_return_if_fail macro */
const char _dbus_return_if_fail_warning_format[] =
-"Arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\n"
+"%lu: arguments to %s() were incorrect, assertion \"%s\" failed in file %s line %d.\n"
"This is normally a bug in some application using the D-BUS library.\n";
#endif
@@ -448,8 +450,8 @@
{
if (!condition)
{
- _dbus_warn ("Assertion failed \"%s\" file \"%s\" line %d process %lu\n",
- condition_text, file, line, _dbus_getpid ());
+ _dbus_warn ("%lu: assertion failed \"%s\" file \"%s\" line %d\n",
+ _dbus_getpid (), condition_text, file, line);
_dbus_abort ();
}
}
Index: dbus-internals.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-internals.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- dbus-internals.h 30 Sep 2003 02:32:52 -0000 1.37
+++ dbus-internals.h 16 Oct 2003 06:34:51 -0000 1.38
@@ -94,18 +94,18 @@
#else
extern const char _dbus_return_if_fail_warning_format[];
-#define _dbus_return_if_fail(condition) do { \
- if (!(condition)) { \
- _dbus_warn (_dbus_return_if_fail_warning_format, \
- _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
- return; \
+#define _dbus_return_if_fail(condition) do { \
+ if (!(condition)) { \
+ _dbus_warn (_dbus_return_if_fail_warning_format, \
+ _dbus_getpid (), _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
+ return; \
} } while (0)
-#define _dbus_return_val_if_fail(condition, val) do { \
- if (!(condition)) { \
- _dbus_warn (_dbus_return_if_fail_warning_format, \
- _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
- return (val); \
+#define _dbus_return_val_if_fail(condition, val) do { \
+ if (!(condition)) { \
+ _dbus_warn (_dbus_return_if_fail_warning_format, \
+ _dbus_getpid (), _DBUS_FUNCTION_NAME, #condition, __FILE__, __LINE__); \
+ return (val); \
} } while (0)
#endif /* !DBUS_DISABLE_ASSERT */
Index: dbus-message.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- dbus-message.c 14 Oct 2003 22:16:03 -0000 1.109
+++ dbus-message.c 16 Oct 2003 06:34:51 -0000 1.110
@@ -1870,6 +1870,9 @@
if (!dbus_message_iter_append_string (&iter, va_arg (var_args, const char *)))
goto errorout;
break;
+ case DBUS_TYPE_OBJECT_PATH:
+
+ break;
case DBUS_TYPE_NAMED:
{
const char *name;
@@ -2540,7 +2543,10 @@
_dbus_return_val_if_fail (dbus_message_iter_check (real), DBUS_TYPE_INVALID);
if (real->pos >= real->end)
- return DBUS_TYPE_INVALID;
+ {
+ _dbus_verbose (" iterator at or beyond end of message\n");
+ return DBUS_TYPE_INVALID;
+ }
pos = dbus_message_iter_get_data_start (real, &type);
@@ -2645,6 +2651,36 @@
pos, NULL);
}
+#if 0
+/**
+ * @todo FIXME to finish this _dbus_demarshal_object_path() needs
+ * to not explode the path.
+ *
+ * Returns the object path value that an iterator may point to.
+ * Note that you need to check that the iterator points to
+ * an object path value before using this function.
+ *
+ * @see dbus_message_iter_get_arg_type
+ * @param iter the message iter
+ * @returns the path
+ */
+char *
+dbus_message_iter_get_object_path (DBusMessageIter *iter)
+{
+ DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
+ int type, pos;
+
+ _dbus_return_val_if_fail (dbus_message_iter_check (real), NULL);
+
+ pos = dbus_message_iter_get_data_start (real, &type);
+
+ _dbus_assert (type == DBUS_TYPE_OBJECT_PATH);
+
+ return _dbus_demarshal_object_path (&real->message->body, real->message->byte_order,
+ pos, NULL);
+}
+#endif
+
/**
* Returns the name and data from a named type that an
* iterator may point to. Note that you need to check that
@@ -3226,7 +3262,7 @@
/**
* Returns the string array that the iterator may point to.
* Note that you need to check that the iterator points
- * to a byte array prior to using this function.
+ * to a string array prior to using this function.
*
* The returned value is a #NULL-terminated array of strings.
* Each string is a separate malloc block, and the array
@@ -3262,6 +3298,50 @@
return TRUE;
}
+#if 0
+/**
+ * @todo FIXME to implement this _dbus_demarshal_object_path_array()
+ * needs implementing
+ *
+ * Returns the object path array that the iterator may point to.
+ * Note that you need to check that the iterator points
+ * to an object path array prior to using this function.
+ *
+ * The returned value is a #NULL-terminated array of strings.
+ * Each string is a separate malloc block, and the array
+ * itself is a malloc block. You can free this type of
+ * array with dbus_free_string_array().
+ *
+ * @param iter the iterator
+ * @param value return location for string values
+ * @param len return location for length of byte array
+ * @returns #TRUE on success
+ */
+dbus_bool_t
+dbus_message_iter_get_object_path_array (DBusMessageIter *iter,
+ char ***value,
+ int *len)
+{
+ DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
+ int type, pos;
+
+ _dbus_return_val_if_fail (dbus_message_iter_check (real), FALSE);
+
+ pos = dbus_message_iter_get_data_start (real, &type);
+
+ _dbus_assert (type == DBUS_TYPE_ARRAY);
+
+ type = iter_get_array_type (real, NULL);
+ _dbus_assert (type == DBUS_TYPE_OBJECT_PATH);
+
+ if (!_dbus_demarshal_object_path_array (&real->message->body, real->message->byte_order,
+ pos, NULL, value, len))
+ return FALSE;
+ else
+ return TRUE;
+}
+#endif
+
/**
* Returns the key name fot the dict entry that an iterator
* may point to. Note that you need to check that the iterator
@@ -3664,6 +3744,8 @@
/**
* Appends a UTF-8 string to the message.
*
+ * @todo add return_val_if_fail(UTF-8 is valid)
+ *
* @param iter an iterator pointing to the end of the message
* @param value the string
* @returns #TRUE on success
@@ -3675,7 +3757,7 @@
DBusMessageRealIter *real = (DBusMessageRealIter *)iter;
_dbus_return_val_if_fail (dbus_message_iter_append_check (real), FALSE);
-
+
if (!dbus_message_iter_append_type (real, DBUS_TYPE_STRING))
return FALSE;
@@ -4971,7 +5053,11 @@
fields[field].name_offset = pos;
fields[field].value_offset = _DBUS_ALIGN_VALUE (pos, 4);
- _dbus_verbose ("Found reply serial at offset %d\n",
+ _dbus_verbose ("Found reply serial %u at offset %d\n",
+ _dbus_demarshal_uint32 (data,
+ byte_order,
+ fields[field].value_offset,
+ NULL),
fields[field].value_offset);
break;
@@ -6751,6 +6837,8 @@
const unsigned char our_boolean_array[] = { TRUE, FALSE, TRUE, TRUE, FALSE };
char sig[64];
const char *s;
+ char *t;
+ DBusError error;
_dbus_assert (sizeof (DBusMessageRealIter) <= sizeof (DBusMessageIter));
@@ -6952,7 +7040,7 @@
_dbus_assert (strcmp (name1, name2) == 0);
- dbus_message_unref (message);
+ dbus_message_unref (message);
dbus_message_unref (copy);
message = dbus_message_new_method_call ("org.freedesktop.DBus.TestService",
@@ -6999,7 +7087,7 @@
"data", 5);
message_iter_test (message);
-
+
/* Message loader test */
_dbus_message_lock (message);
loader = _dbus_message_loader_new ();
@@ -7030,6 +7118,7 @@
_dbus_message_loader_return_buffer (loader, buffer, 1);
}
+ copy = dbus_message_copy (message); /* save for tests below */
dbus_message_unref (message);
/* Now pop back the message */
@@ -7051,6 +7140,31 @@
dbus_message_unref (message);
_dbus_message_loader_unref (loader);
+ message = dbus_message_new_method_return (copy);
+ if (message == NULL)
+ _dbus_assert_not_reached ("out of memory\n");
+ dbus_message_unref (copy);
+
+ if (!dbus_message_append_args (message,
+ DBUS_TYPE_STRING, "hello",
+ DBUS_TYPE_INVALID))
+ _dbus_assert_not_reached ("no memory");
+
+ if (!dbus_message_has_signature (message, "s"))
+ _dbus_assert_not_reached ("method return has wrong signature");
+
+ dbus_error_init (&error);
+ if (!dbus_message_get_args (message, &error, DBUS_TYPE_STRING,
+ &t, DBUS_TYPE_INVALID))
+
+ {
+ _dbus_warn ("Failed to get expected string arg: %s\n", error.message);
+ exit (1);
+ }
+ dbus_free (t);
+
+ dbus_message_unref (message);
+
/* Now load every message in test_data_dir if we have one */
if (test_data_dir == NULL)
return TRUE;
Index: dbus-message.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.h,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- dbus-message.h 12 Oct 2003 00:55:11 -0000 1.45
+++ dbus-message.h 16 Oct 2003 06:34:51 -0000 1.46
@@ -146,28 +146,28 @@
va_list var_args);
-
-void dbus_message_iter_init (DBusMessage *message,
- DBusMessageIter *iter);
-dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
-dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
-int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
-int dbus_message_iter_get_array_type (DBusMessageIter *iter);
-unsigned char dbus_message_iter_get_byte (DBusMessageIter *iter);
-dbus_bool_t dbus_message_iter_get_boolean (DBusMessageIter *iter);
-dbus_int32_t dbus_message_iter_get_int32 (DBusMessageIter *iter);
-dbus_uint32_t dbus_message_iter_get_uint32 (DBusMessageIter *iter);
+void dbus_message_iter_init (DBusMessage *message,
+ DBusMessageIter *iter);
+dbus_bool_t dbus_message_iter_has_next (DBusMessageIter *iter);
+dbus_bool_t dbus_message_iter_next (DBusMessageIter *iter);
+int dbus_message_iter_get_arg_type (DBusMessageIter *iter);
+int dbus_message_iter_get_array_type (DBusMessageIter *iter);
+unsigned char dbus_message_iter_get_byte (DBusMessageIter *iter);
+dbus_bool_t dbus_message_iter_get_boolean (DBusMessageIter *iter);
+dbus_int32_t dbus_message_iter_get_int32 (DBusMessageIter *iter);
+dbus_uint32_t dbus_message_iter_get_uint32 (DBusMessageIter *iter);
#ifdef DBUS_HAVE_INT64
-dbus_int64_t dbus_message_iter_get_int64 (DBusMessageIter *iter);
-dbus_uint64_t dbus_message_iter_get_uint64 (DBusMessageIter *iter);
+dbus_int64_t dbus_message_iter_get_int64 (DBusMessageIter *iter);
+dbus_uint64_t dbus_message_iter_get_uint64 (DBusMessageIter *iter);
#endif /* DBUS_HAVE_INT64 */
-double dbus_message_iter_get_double (DBusMessageIter *iter);
-char * dbus_message_iter_get_string (DBusMessageIter *iter);
-char * dbus_message_iter_get_dict_key (DBusMessageIter *iter);
-dbus_bool_t dbus_message_iter_get_named (DBusMessageIter *iter,
- char **name,
- unsigned char **value,
- int *len);
+double dbus_message_iter_get_double (DBusMessageIter *iter);
+char * dbus_message_iter_get_string (DBusMessageIter *iter);
+char * dbus_message_iter_get_object_path (DBusMessageIter *iter);
+char * dbus_message_iter_get_dict_key (DBusMessageIter *iter);
+dbus_bool_t dbus_message_iter_get_named (DBusMessageIter *iter,
+ char **name,
+ unsigned char **value,
+ int *len);
void dbus_message_iter_init_array_iterator (DBusMessageIter *iter,
DBusMessageIter *array_iter,
@@ -200,6 +200,9 @@
dbus_bool_t dbus_message_iter_get_string_array (DBusMessageIter *iter,
char ***value,
int *len);
+dbus_bool_t dbus_message_iter_get_object_path_array (DBusMessageIter *iter,
+ char ***value,
+ int *len);
void dbus_message_append_iter_init (DBusMessage *message,
Index: dbus-pending-call.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-pending-call.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- dbus-pending-call.c 12 Oct 2003 05:59:39 -0000 1.3
+++ dbus-pending-call.c 16 Oct 2003 06:34:51 -0000 1.4
@@ -293,14 +293,16 @@
if (dbus_pending_call_get_completed (pending))
return;
-
+
+ /* message may be NULL if no reply */
message = _dbus_connection_block_for_reply (pending->connection,
pending->reply_serial,
dbus_timeout_get_interval (pending->timeout));
_dbus_connection_lock (pending->connection);
_dbus_pending_call_complete_and_unlock (pending, message);
- dbus_message_unref (message);
+ if (message)
+ dbus_message_unref (message);
}
static DBusDataSlotAllocator slot_allocator;
Index: dbus-sysdeps.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- dbus-sysdeps.c 11 Oct 2003 06:20:28 -0000 1.66
+++ dbus-sysdeps.c 16 Oct 2003 06:34:51 -0000 1.67
@@ -76,6 +76,12 @@
void
_dbus_abort (void)
{
+#ifdef DBUS_ENABLE_VERBOSE_MODE
+ const char *s;
+ s = _dbus_getenv ("DBUS_PRINT_BACKTRACE");
+ if (s && *s)
+ _dbus_print_backtrace ();
+#endif
abort ();
_exit (1); /* in case someone manages to ignore SIGABRT */
}
@@ -3109,7 +3115,11 @@
{
const char *s;
pid_t child_pid;
+ int dev_null_fd;
+ _dbus_verbose ("Becoming a daemon...\n");
+
+ _dbus_verbose ("chdir to /\n");
if (chdir ("/") < 0)
{
dbus_set_error (error, DBUS_ERROR_FAILED,
@@ -3117,59 +3127,61 @@
return FALSE;
}
+ _dbus_verbose ("forking...\n");
switch ((child_pid = fork ()))
{
case -1:
+ _dbus_verbose ("fork failed\n");
dbus_set_error (error, _dbus_error_from_errno (errno),
"Failed to fork daemon: %s", _dbus_strerror (errno));
return FALSE;
break;
case 0:
+ _dbus_verbose ("in child, closing std file descriptors\n");
-
- s = _dbus_getenv ("DBUS_DEBUG_DAEMONIZE");
- if (s != NULL)
- kill (_dbus_getpid (), SIGSTOP);
+ /* silently ignore failures here, if someone
+ * doesn't have /dev/null we may as well try
+ * to continue anyhow
+ */
- s = _dbus_getenv ("DBUS_DEBUG_OUTPUT");
- if (s == NULL || *s == '\0')
+ dev_null_fd = open ("/dev/null", O_RDWR);
+ if (dev_null_fd >= 0)
{
- int dev_null_fd;
-
- /* silently ignore failures here, if someone
- * doesn't have /dev/null we may as well try
- * to continue anyhow
- */
-
- dev_null_fd = open ("/dev/null", O_RDWR);
- if (dev_null_fd >= 0)
- {
- dup2 (dev_null_fd, 0);
- dup2 (dev_null_fd, 1);
- dup2 (dev_null_fd, 2);
- }
+ dup2 (dev_null_fd, 0);
+ dup2 (dev_null_fd, 1);
+
+ s = _dbus_getenv ("DBUS_DEBUG_OUTPUT");
+ if (s == NULL || *s == '\0')
+ dup2 (dev_null_fd, 2);
+ else
+ _dbus_verbose ("keeping stderr open due to DBUS_DEBUG_OUTPUT\n");
}
/* Get a predictable umask */
+ _dbus_verbose ("setting umask\n");
umask (022);
break;
default:
if (pidfile)
{
+ _dbus_verbose ("parent writing pid file\n");
if (!_dbus_write_pid_file (pidfile,
child_pid,
error))
{
+ _dbus_verbose ("pid file write failed, killing child\n");
kill (child_pid, SIGTERM);
return FALSE;
}
}
+ _dbus_verbose ("parent exiting\n");
_exit (0);
break;
}
+ _dbus_verbose ("calling setsid()\n");
if (setsid () == -1)
_dbus_assert_not_reached ("setsid() failed");