diff options
author | Havoc Pennington <hp@redhat.com> | 2003-04-02 21:43:29 +0000 |
---|---|---|
committer | Havoc Pennington <hp@redhat.com> | 2003-04-02 21:43:29 +0000 |
commit | 94790fef4a846ef2bed9bf1825c4c2b0ca7b8566 (patch) | |
tree | 4d10bb9e8c16060113b8470507d635f6502796f5 /bus/config-loader-expat.c | |
parent | e55fd2c6706e41f6933e1656ac3da7527ee2514f (diff) |
2003-04-02 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps.c (_dbus_file_get_contents): include filenames
in error messages
(_dbus_string_get_dirname): new
(_dbus_sysdeps_test): new
(_dbus_directory_open): include dirnames in error messages
* bus/config-parser.c: interpret <include> and <includedir> and
<servicedir> relative to config file location if the given
filename is not absolute.
* dbus/dbus-string.c (_dbus_string_find_byte_backward): new
Diffstat (limited to 'bus/config-loader-expat.c')
-rw-r--r-- | bus/config-loader-expat.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/bus/config-loader-expat.c b/bus/config-loader-expat.c index 9e6de5e2..372a8867 100644 --- a/bus/config-loader-expat.c +++ b/bus/config-loader-expat.c @@ -170,7 +170,8 @@ bus_config_load (const DBusString *file, const char *filename; BusConfigParser *parser; ExpatParseContext context; - + DBusString dirname; + _DBUS_ASSERT_ERROR_IS_CLEAR (error); parser = NULL; @@ -186,6 +187,13 @@ bus_config_load (const DBusString *file, return NULL; } + if (!_dbus_string_init (&dirname)) + { + dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); + _dbus_string_free (&context.content); + return NULL; + } + expat = XML_ParserCreate_MM ("UTF-8", &memsuite, NULL); if (expat == NULL) { @@ -193,7 +201,13 @@ bus_config_load (const DBusString *file, goto failed; } - parser = bus_config_parser_new (); + if (!_dbus_string_get_dirname (file, &dirname)) + { + dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); + goto failed; + } + + parser = bus_config_parser_new (&dirname); if (parser == NULL) { dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); @@ -258,6 +272,7 @@ bus_config_load (const DBusString *file, if (!bus_config_parser_finished (parser, error)) goto failed; + _dbus_string_free (&dirname); _dbus_string_free (&context.content); XML_ParserFree (expat); @@ -267,6 +282,7 @@ bus_config_load (const DBusString *file, failed: _DBUS_ASSERT_ERROR_IS_SET (error); + _dbus_string_free (&dirname); _dbus_string_free (&context.content); if (expat) XML_ParserFree (expat); |