dbus/bus activation.c, 1.45, 1.46 desktop-file.c, 1.13,
1.14 desktop-file.h, 1.5, 1.6
John Palmieri
johnp at kemper.freedesktop.org
Mon Sep 11 08:24:12 PDT 2006
Update of /cvs/dbus/dbus/bus
In directory kemper:/tmp/cvs-serv13015/bus
Modified Files:
activation.c desktop-file.c desktop-file.h
Log Message:
* bus/activation.c, bus/desktop-file.c: Distinguish between OOM and
key not found
Index: activation.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/activation.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- activation.c 6 Sep 2006 00:14:06 -0000 1.45
+++ activation.c 11 Sep 2006 15:24:10 -0000 1.46
@@ -285,22 +285,16 @@
if (!bus_desktop_file_get_string (desktop_file,
DBUS_SERVICE_SECTION,
DBUS_SERVICE_NAME,
- &name))
- {
- dbus_set_error (error, DBUS_ERROR_FAILED,
- "No \""DBUS_SERVICE_NAME"\" key in .service file\n");
- goto failed;
- }
+ &name,
+ error))
+ goto failed;
if (!bus_desktop_file_get_string (desktop_file,
DBUS_SERVICE_SECTION,
DBUS_SERVICE_EXEC,
- &exec))
- {
- dbus_set_error (error, DBUS_ERROR_FAILED,
- "No \""DBUS_SERVICE_EXEC"\" key in .service file\n");
- goto failed;
- }
+ &exec,
+ error))
+ goto failed;
entry = _dbus_hash_table_lookup_string (s_dir->entries,
_dbus_string_get_const_data (filename));
@@ -466,7 +460,10 @@
retval = TRUE;
goto out;
}
-
+
+ /* @todo We can return OOM or a DBUS_ERROR_FAILED error
+ * Handle these both better
+ */
if (!update_desktop_file_entry (activation, entry->s_dir, &filename, desktop_file, &tmp_error))
{
bus_desktop_file_free (desktop_file);
@@ -593,6 +590,9 @@
continue;
}
+ /* @todo We can return OOM or a DBUS_ERROR_FAILED error
+ * Handle these both better
+ */
if (!update_desktop_file_entry (activation, s_dir, &filename, desktop_file, &tmp_error))
{
bus_desktop_file_free (desktop_file);
Index: desktop-file.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/desktop-file.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- desktop-file.c 6 Sep 2006 00:14:06 -0000 1.13
+++ desktop-file.c 11 Sep 2006 15:24:10 -0000 1.14
@@ -761,22 +761,29 @@
bus_desktop_file_get_string (BusDesktopFile *desktop_file,
const char *section,
const char *keyname,
- char **val)
+ char **val,
+ DBusError *error)
{
const char *raw;
-
+
+ _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
*val = NULL;
if (!bus_desktop_file_get_raw (desktop_file, section, keyname, &raw))
- return FALSE;
+ {
+ dbus_set_error (error, DBUS_ERROR_FAILED,
+ "No \"%s\" key in .service file\n", keyname);
+ return FALSE;
+ }
*val = _dbus_strdup (raw);
- /* FIXME 1.0 we don't distinguish "key not found" from "out of memory" here,
- * which is broken.
- */
if (*val == NULL)
- return FALSE;
+ {
+ BUS_SET_OOM (error);
+ return FALSE;
+ }
return TRUE;
}
Index: desktop-file.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/desktop-file.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- desktop-file.h 10 Aug 2004 03:06:59 -0000 1.5
+++ desktop-file.h 11 Sep 2006 15:24:10 -0000 1.6
@@ -43,7 +43,8 @@
dbus_bool_t bus_desktop_file_get_string (BusDesktopFile *desktop_file,
const char *section,
const char *keyname,
- char **val);
+ char **val,
+ DBusError *error);
#endif /* BUS_DESKTOP_FILE_H */
More information about the dbus-commit
mailing list