From e43eda2e79fdcfc87663ceb0c9a6ed7faf3ca5c6 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 2 Dec 2009 17:42:24 -0500
Subject: [PATCH] Allow empty configuration files in expat parser

Right now, if someone drops an empty .conf file
in /etc/dbus-1/system.d the parser chokes.  It
should probably just ignore them.
---
 bus/config-loader-expat.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/bus/config-loader-expat.c b/bus/config-loader-expat.c
index 4b29f32..dbe4f64 100644
--- a/bus/config-loader-expat.c
+++ b/bus/config-loader-expat.c
@@ -252,7 +252,7 @@ bus_config_load (const DBusString      *file,
             e = XML_GetErrorCode (expat);
             if (e == XML_ERROR_NO_MEMORY)
               dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
-            else
+            else if (e != XML_ERROR_NO_ELEMENTS)
               dbus_set_error (error, DBUS_ERROR_FAILED,
                               "Error in file %s, line %d, column %d: %s\n",
                               filename,
@@ -262,7 +262,9 @@ bus_config_load (const DBusString      *file,
           }
 
         _dbus_string_free (&data);
-        goto failed;
+
+        if (dbus_error_is_set (error))
+          goto failed;
       }
 
     _dbus_string_free (&data);
-- 
1.6.5.2

