- fixed dbus_bus_request_name
[platform/upstream/dbus.git] / dbus / dbus-userdb-util.c
index 5af0092..38ea4ef 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)