From 2aa38be20b015777ec6570d1e2fd7e072f5f3be9 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 15 Feb 2003 17:18:13 +0000 Subject: 2003-02-15 Anders Carlsson * dbus/dbus-errors.c: (dbus_set_error): * dbus/dbus-errors.h: Add a few errors and make dbus_set_error void. * dbus/dbus-sysdeps.c: (_dbus_errno_to_string), (close_and_invalidate), (make_pipe), (write_err_and_exit), (read_ints), (do_exec), (_dbus_spawn_async): * dbus/dbus-sysdeps.h: Add _dbus_spawn_async. * test/spawn-test.c: (main): Test for _dbus_spawn_async. --- dbus/dbus-errors.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'dbus/dbus-errors.c') diff --git a/dbus/dbus-errors.c b/dbus/dbus-errors.c index a679e6c6..dfc52fb3 100644 --- a/dbus/dbus-errors.c +++ b/dbus/dbus-errors.c @@ -214,12 +214,14 @@ dbus_set_error_const (DBusError *error, * Assigns an error name and message to a DBusError. * Does nothing if error is #NULL. * + * If no memory can be allocated for the error message, + * an out-of-memory error message will be set instead. + * * @param error the error. * @param name the error name (not copied!!!) * @param format printf-style format string. - * @returns #TRUE on success. */ -dbus_bool_t +void dbus_set_error (DBusError *error, const char *name, const char *format, @@ -232,7 +234,7 @@ dbus_set_error (DBusError *error, char c; if (error == NULL) - return TRUE; + return; va_start (args, format); @@ -246,8 +248,12 @@ dbus_set_error (DBusError *error, vsprintf (message, format, args2); if (!message) - return FALSE; - + { + dbus_set_error_const (error, DBUS_ERROR_NO_MEMORY, + "Failed to allocate memory for error message."); + return; + } + va_end (args); dbus_error_init (error); @@ -256,8 +262,6 @@ dbus_set_error (DBusError *error, real->name = name; real->message = message; real->const_message = FALSE; - - return TRUE; } /** @} */ -- cgit