--- old.patch	2011-06-27 10:49:23.000000000 +0200
+++ 1083982-remove-unecessary-drupal-realpath.patch	2011-06-27 10:49:12.000000000 +0200
@@ -14,7 +13,7 @@
  function file_copy(stdClass $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
    if (!file_valid_uri($destination)) {
 -    watchdog('file', 'File %file (%realpath) could not be copied, because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => drupal_realpath($source->uri), '%destination' => $destination));
-+    if ($realpath = drupal_realpath($source->uri)) {
++    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
 +      watchdog('file', 'File %file (%realpath) could not be copied, because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
 +    }
 +    else {
@@ -32,7 +31,7 @@
      // @todo Replace drupal_set_message() calls with exceptions instead.
      drupal_set_message(t('The specified file %file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.', array('%file' => $original_source)), 'error');
 -    watchdog('file', 'File %file (%realpath) could not be copied because it does not exist.', array('%file' => $original_source, '%realpath' => drupal_realpath($original_source)));
-+    if ($realpath = drupal_realpath($original_source)) {
++    if (($realpath = drupal_realpath($original_source)) !== FALSE) {
 +      watchdog('file', 'File %file (%realpath) could not be copied because it does not exist.', array('%file' => $original_source, '%realpath' => $realpath));
 +    }
 +    else {
@@ -63,7 +62,7 @@
 -  if (drupal_realpath($source) == drupal_realpath($destination)) {
 +  $real_source = drupal_realpath($source);
 +  $real_destination = drupal_realpath($destination);
-+  if ($source == $destination || ($real_source !== FALSE) && ($real_destination !== FALSE)  && ($real_source == $real_destination)) {
++  if ($source == $destination || ($real_source !== FALSE) && ($real_source == $real_destination)) {
      drupal_set_message(t('The specified file %file was not copied because it would overwrite itself.', array('%file' => $source)), 'error');
      watchdog('file', 'File %file could not be copied because it would overwrite itself.', array('%file' => $source));
      return FALSE;
@@ -81,7 +80,7 @@
  function file_move(stdClass $source, $destination = NULL, $replace = FILE_EXISTS_RENAME) {
    if (!file_valid_uri($destination)) {
 -    watchdog('file', 'File %file (%realpath) could not be moved, because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => drupal_realpath($source->uri), '%destination' => $destination));
-+    if ($realpath = drupal_realpath($source->uri)) {
++    if (($realpath = drupal_realpath($source->uri)) !== FALSE) {
 +      watchdog('file', 'File %file (%realpath) could not be moved, because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.', array('%file' => $source->uri, '%realpath' => $realpath, '%destination' => $destination));
 +    }
 +    else {
@@ -95,7 +94,7 @@
  function file_delete(stdClass $file, $force = FALSE) {
    if (!file_valid_uri($file->uri)) {
 -    watchdog('file', 'File %file (%realpath) could not be deleted because it is not a valid URI. This may be caused by improper use of file_delete() or a missing stream wrapper.', array('%file' => $file->uri, '%realpath' => drupal_realpath($file->uri)));
-+    if ($realpath = drupal_realpath($file->uri)) {
++    if (($realpath = drupal_realpath($file->uri)) !== FALSE) {
 +      watchdog('file', 'File %file (%realpath) could not be deleted because it is not a valid URI. This may be caused by improper use of file_delete() or a missing stream wrapper.', array('%file' => $file->uri, '%realpath' => $realpath));
 +    }
 +    else {
