diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-05-14 12:17:54 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2015-05-14 14:30:30 +0100 |
commit | 49646211f3c8dcdc3728f4059c61c05ef4df857c (patch) | |
tree | f6e66a427de201d71776113eb5c1ea6b48eace77 /dbus/dbus-server.c | |
parent | f180a839727981c8896056a35df17768d54eada6 (diff) | |
download | dbus-49646211f3c8dcdc3728f4059c61c05ef4df857c.tar.gz |
_dbus_server_init_base: raise a DBusError
This can currently only fail from OOM, but I'm about to make
it possible to fail from insufficient entropy.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=90414
Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
[smcv: document @error]
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Diffstat (limited to 'dbus/dbus-server.c')
-rw-r--r-- | dbus/dbus-server.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c index 7b810792..42891bde 100644 --- a/dbus/dbus-server.c +++ b/dbus/dbus-server.c @@ -105,12 +105,14 @@ copy_address_with_guid_appended (const DBusString *address, * @param server the server. * @param vtable the vtable for the subclass. * @param address the server's address + * @param error location to store reason for failure * @returns #TRUE on success. */ dbus_bool_t _dbus_server_init_base (DBusServer *server, const DBusServerVTable *vtable, - const DBusString *address) + const DBusString *address, + DBusError *error) { server->vtable = vtable; @@ -130,29 +132,32 @@ _dbus_server_init_base (DBusServer *server, server->published_address = FALSE; if (!_dbus_string_init (&server->guid_hex)) - return FALSE; + { + _DBUS_SET_OOM (error); + return FALSE; + } _dbus_generate_uuid (&server->guid); if (!_dbus_uuid_encode (&server->guid, &server->guid_hex)) - goto failed; + goto oom; server->address = copy_address_with_guid_appended (address, &server->guid_hex); if (server->address == NULL) - goto failed; + goto oom; _dbus_rmutex_new_at_location (&server->mutex); if (server->mutex == NULL) - goto failed; + goto oom; server->watches = _dbus_watch_list_new (); if (server->watches == NULL) - goto failed; + goto oom; server->timeouts = _dbus_timeout_list_new (); if (server->timeouts == NULL) - goto failed; + goto oom; _dbus_data_slot_list_init (&server->slot_list); @@ -160,7 +165,8 @@ _dbus_server_init_base (DBusServer *server, return TRUE; - failed: + oom: + _DBUS_SET_OOM (error); _dbus_rmutex_free_at_location (&server->mutex); server->mutex = NULL; if (server->watches) |