[daemon-fix] Fixed sending daemon match rules for kdbus broadcasts
[platform/upstream/dbus.git] / dbus / dbus-userdb-util.c
index 5af0092..62495d8 100644 (file)
@@ -104,7 +104,11 @@ _dbus_is_console_user (dbus_uid_t uid,
 
 #endif /* HAVE_CONSOLE_OWNER_FILE */
 
-  _dbus_user_database_lock_system ();
+  if (!_dbus_user_database_lock_system ())
+    {
+      _DBUS_SET_OOM (error);
+      return FALSE;
+    }
 
   db = _dbus_user_database_get_system ();
   if (db == NULL)
@@ -158,7 +162,10 @@ _dbus_get_group_id (const DBusString  *groupname,
 {
   DBusUserDatabase *db;
   const DBusGroupInfo *info;
-  _dbus_user_database_lock_system ();
+
+  /* FIXME: this can't distinguish ENOMEM from other errors */
+  if (!_dbus_user_database_lock_system ())
+    return FALSE;
 
   db = _dbus_user_database_get_system ();
   if (db == NULL)
@@ -195,7 +202,10 @@ _dbus_get_user_id_and_primary_group (const DBusString  *username,
 {
   DBusUserDatabase *db;
   const DBusUserInfo *info;
-  _dbus_user_database_lock_system ();
+
+  /* FIXME: this can't distinguish ENOMEM from other errors */
+  if (!_dbus_user_database_lock_system ())
+    return FALSE;
 
   db = _dbus_user_database_get_system ();
   if (db == NULL)
@@ -388,7 +398,9 @@ _dbus_groups_from_uid (dbus_uid_t         uid,
   *group_ids = NULL;
   *n_group_ids = 0;
 
-  _dbus_user_database_lock_system ();
+  /* FIXME: this can't distinguish ENOMEM from other errors */
+  if (!_dbus_user_database_lock_system ())
+    return FALSE;
 
   db = _dbus_user_database_get_system ();
   if (db == NULL)
@@ -425,7 +437,7 @@ _dbus_groups_from_uid (dbus_uid_t         uid,
 }
 /** @} */
 
-#ifdef DBUS_BUILD_TESTS
+#ifdef DBUS_ENABLE_EMBEDDED_TESTS
 #include <stdio.h>
 
 /**
@@ -478,4 +490,4 @@ _dbus_userdb_test (const char *test_data_dir)
 
   return TRUE;
 }
-#endif /* DBUS_BUILD_TESTS */
+#endif /* DBUS_ENABLE_EMBEDDED_TESTS */