summaryrefslogtreecommitdiffstats
path: root/bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-08-07 01:33:14 +0200
committerLennart Poettering <lennart@poettering.net>2009-10-17 00:28:31 +0200
commit1f179e0f27f656ed3c5d1ee2ac5e1bbfe26d9d94 (patch)
treef239fdaf9e72954e153d33b88e0c1fd2a04d90bf /bus
parent2ed34f69d4400f863835c4149be4ecb82ffe1c72 (diff)
desktop-file: fix stat() race
_dbus_desktop_file_load() used to stat the desktop file before reading it, to verify its size. This is both racy and unnecessary since _dbus_file_get_contents() which it uses stats the file anyway -- does that however in a race-free fashion with fstat() instead of stat(). This patch gets rid of the redundant stat(). Also, since the desktop file change logic requires the mtime of the file it read we now export that in _dbus_file_get_contents(). This patch probably breaks Win32 builds, but afaik those are broken anyway.
Diffstat (limited to 'bus')
-rw-r--r--bus/config-loader-expat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/bus/config-loader-expat.c b/bus/config-loader-expat.c
index c0620aed..b6c92451 100644
--- a/bus/config-loader-expat.c
+++ b/bus/config-loader-expat.c
@@ -173,7 +173,7 @@ bus_config_load (const DBusString *file,
BusConfigParser *parser;
ExpatParseContext context;
DBusString dirname;
-
+
_DBUS_ASSERT_ERROR_IS_CLEAR (error);
parser = NULL;
@@ -195,7 +195,7 @@ bus_config_load (const DBusString *file,
_dbus_string_free (&context.content);
return NULL;
}
-
+
expat = XML_ParserCreate_MM ("UTF-8", &memsuite, NULL);
if (expat == NULL)
{
@@ -208,7 +208,7 @@ bus_config_load (const DBusString *file,
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
goto failed;
}
-
+
parser = bus_config_parser_new (&dirname, is_toplevel, parent);
if (parser == NULL)
{
@@ -234,7 +234,7 @@ bus_config_load (const DBusString *file,
goto failed;
}
- if (!_dbus_file_get_contents (&data, file, error))
+ if (!_dbus_file_get_contents (&data, file, NULL, error))
{
_dbus_string_free (&data);
goto failed;