Browse Source

posix_* functions don't exist on !UNIX platforms. Adding workarounds.

graf25 23 years ago
parent
commit
3a3bfa2c2c
1 changed files with 5 additions and 2 deletions
  1. 5 2
      functions/file_prefs.php

+ 5 - 2
functions/file_prefs.php

@@ -168,8 +168,11 @@ function checkForPrefs($data_dir, $username, $filename = '') {
             logout_error( $errString, $errTitle );
             exit;
         } else if (!@copy($default_pref, $filename)) {
-            $user_data = posix_getpwuid(posix_getuid());
-            $uid = $user_data['name'];
+            $uid = 'httpd';
+            if (function_exists('posix_getuid')){
+                $user_data = posix_getpwuid(posix_getuid());
+                $uid = $user_data['name'];
+            }
             $errString = $errTitle . '<br>' .
                        _("Could not create initial preference file!") . "<br>\n" .
                        sprintf( _("%s should be writable by user %s"), $data_dir, $uid ) .