--- install.orig.inc	2006-12-06 20:28:21.421875000 -0500
+++ install.inc	2006-12-07 00:21:29.375000000 -0500
@@ -496,48 +496,46 @@ function drupal_install_mkdir($file, $ma
  *  TRUE/FALSE whether or not we were able to fix the file's permissions.
  */
 function drupal_install_fix_file($file, $mask, $message = TRUE) {
-  $mod = substr(sprintf('%o', fileperms($file)), -4);
-  $prefix = substr($mod, 0, 1);
-  $mod = substr($mod, 1 ,4);
+  $mod = fileperms($file) & 0777;
   $masks = array(FILE_READABLE, FILE_WRITABLE, FILE_EXECUTABLE, FILE_NOT_READABLE, FILE_NOT_WRITABLE, FILE_NOT_EXECUTABLE);
   foreach ($masks as $m) {
     if ($mask & $m) {
       switch ($m) {
         case FILE_READABLE:
           if (!is_readable($file)) {
-            $mod += 444;
+            $mod |= 0444;
           }
           break;
         case FILE_WRITABLE:
           if (!is_writable($file)) {
-            $mod += 222;
+            $mod |= 0222;
           }
           break;
         case FILE_EXECUTABLE:
           if (!is_executable($file)) {
-            $mod += 111;
+            $mod |= 0111;
           }
           break;
         case FILE_NOT_READABLE:
           if (is_readable($file)) {
-            $mod -= 444;
+            $mod &= ~0444;
           }
           break;
         case FILE_NOT_WRITABLE:
           if (is_writable($file)) {
-            $mod -= 222;
+            $mod &= ~0222;
           }
           break;
         case FILE_NOT_EXECUTABLE:
           if (is_executable($file)) {
-            $mod -= 111;
+            $mod &= ~0111;
           }
           break;
       }
     }
   }
 
-  if (@chmod($file, intval("$prefix$mod", 8))) {
+  if (@chmod($file, $mod))) {
     return TRUE;
   }
   else {
