Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1142
diff -u -p -r1.1142 user.module
--- modules/user/user.module	22 Mar 2010 18:55:45 -0000	1.1142
+++ modules/user/user.module	23 Mar 2010 13:33:43 -0000
@@ -779,10 +779,11 @@ function user_file_download($uri) {
  */
 function user_file_references($file) {
   // Determine if the file is used by this module.
-  $count = (int) db_query('SELECT COUNT(1) FROM {users} WHERE picture = :fid', array(':fid' => $file->fid))->fetchField();
-  if ($count) {
+  $file_used = (bool) db_query_range('SELECT 1 FROM {users} WHERE picture = :fid', 0, 1, array(':fid' => $file->fid))->fetchField();
+  if ($file_used) {
     // Return the name of the module and how many references it has to the file.
-    return array('user' => $count);
+    // If file is still used then 1 is enough to indicate this.
+    return array('user' => 1);
   }
 }
 
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.144
diff -u -p -r1.144 system.api.php
--- modules/system/system.api.php	21 Mar 2010 21:20:43 -0000	1.144
+++ modules/system/system.api.php	23 Mar 2010 13:33:43 -0000
@@ -1734,10 +1734,10 @@ function hook_file_move($file, $source) 
  */
 function hook_file_references($file) {
   // If user.module is still using a file, do not let other modules delete it.
-  $count = (int) db_query('SELECT COUNT(picture) FROM {users} WHERE picture = :fid', array(':fid' => $file->fid))->fetchField();
-  if ($count) {
+  $file_used = (bool) db_query_range('SELECT 1 FROM {user} WHERE pictire = :fid', 0, 1, array(':fid' => $file->fid))->fetchField();
+  if ($file_used) {
     // Return the name of the module and how many references it has to the file.
-    return array('user' => $count);
+    return array('user' => 1);
   }
 }
 
