summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2006-09-11 15:24:10 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2006-09-11 15:24:10 +0000
commit9cfb902807e2b568a27227fb11d757ac5cdb3aae (patch)
tree524511180cd97db8ebb77f0a88a7cb813d6eb116
parent05d90f4f20c1fbbb6c532b5f62531c97ced7d63e (diff)
* bus/activation.c, bus/desktop-file.c: Distinguish between OOM and
key not found
-rw-r--r--ChangeLog9
-rw-r--r--bus/activation.c26
-rw-r--r--bus/desktop-file.c21
-rw-r--r--bus/desktop-file.h3
4 files changed, 36 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 18373c1f..83a8b34c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2006-09-08 John (J5) Palmieri <johnp@redhat.com>
+2006-09-11 John (J5) Palmieri <johnp@redhat.com>
+
+ * bus/activation.c, bus/desktop-file.c: Distinguish between OOM and
+ key not found
+
+2006-09-11 John (J5) Palmieri <johnp@redhat.com>
* dbus/dbus-internal.c: Add dbus_is_verbose so we can have more
complex debugging code
@@ -7,7 +12,7 @@
between the test suite ifdefs
(_dbus_verbose_bytes): return if verbosity is not enabled
-2006-09-08 John (J5) Palmieri <johnp@redhat.com>
+2006-09-11 John (J5) Palmieri <johnp@redhat.com>
* dbus/dbus-marshal-recursive-util.c, dbus/dbus-marshal-recursive.c:
remove DBusMark
diff --git a/bus/activation.c b/bus/activation.c
index e1fe2954..fa439c41 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -285,22 +285,16 @@ update_desktop_file_entry (BusActivation *activation,
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 @@ check_service_file (BusActivation *activation,
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 @@ update_directory (BusActivation *activation,
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);
diff --git a/bus/desktop-file.c b/bus/desktop-file.c
index d0f9dbb0..407044c9 100644
--- a/bus/desktop-file.c
+++ b/bus/desktop-file.c
@@ -761,22 +761,29 @@ dbus_bool_t
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;
}
diff --git a/bus/desktop-file.h b/bus/desktop-file.h
index 279641ef..9cf14b3b 100644
--- a/bus/desktop-file.h
+++ b/bus/desktop-file.h
@@ -43,7 +43,8 @@ dbus_bool_t bus_desktop_file_get_raw (BusDesktopFile *desktop_file,
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 */