Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 15646)
+++ wp-includes/functions.php	(working copy)
@@ -2015,42 +2015,55 @@
 }
 
 /**
+ * Make Directories.
+ *
  * Recursive directory creation based on full path.
+ * Attempts to set permissions on newly created folders.
  *
- * Will attempt to set permissions on folders.
+ * As php mkdir() (PHP < 5.0.0) does not support recursive paths, this function mimics 
+ * the *nix `mkdir -p` or `mkdir --parent` command.
  *
+ * In difference to mkdir, the permissions set on newly created folders 
+ * is based on the parent folder permissions - not umask.
+ *
+ * @link http://www.gnu.org/software/coreutils/manual/coreutils.html#mkdir-invocation
+ * @link http://php.net/mkdir
  * @since 2.0.1
  *
- * @param string $target Full path to attempt to create.
- * @return bool Whether the path was created. True if path already exists.
+ * @param string $target Path of a directory to create.
+ * @return bool Whether the target path exists (already or just created does not make a difference).
  */
 function wp_mkdir_p( $target ) {
-	// from php.net/mkdir user contributed notes
-	$target = str_replace( '//', '/', $target );
+	// Normalize $target
+	$target = str_replace( '//', '/', $target ); // undocumented, from a removed php.net/mkdir user-note
+	$target = rtrim( $target, '/' ); // safe mode fails with a trailing slash under certain PHP versions.
+	empty( $target ) && $target = '/'; // empty target is root (posix).
 
-	// safe mode fails with a trailing slash under certain PHP versions.
-	$target = rtrim($target, '/'); // Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
-	if ( empty($target) )
-		$target = '/';
-
+	// Handle existing target.
 	if ( file_exists( $target ) )
 		return @is_dir( $target );
 
-	// Attempting to create the directory may clutter up our display.
-	if ( @mkdir( $target ) ) {
-		$stat = @stat( dirname( $target ) );
-		$dir_perms = $stat['mode'] & 0007777;  // Get the permission bits.
-		@chmod( $target, $dir_perms );
-		return true;
-	} elseif ( is_dir( dirname( $target ) ) ) {
-			return false;
+	// Handle target parent directory (recursion).
+	$parent     = dirname( $target );
+	$has_parent = strlen( $target ) !== strlen( $parent );
+	if ( $has_parent && !wp_mkdir_p( $parent ) )
+		return false;
+
+	// Target directory creation
+	if ( !@mkdir( $target ) )
+		return false;
+
+	// Set Permissions on created target, defaults to 0755/FS_CHMOD_DIR or if 
+	// parent status exists, to the parent's status inode protection mode permissions.
+	$target_perms = defined( 'FS_CHMOD_DIR' ) ? FS_CHMOD_DIR : 0755; // see /wp-admin/includes/file.php
+	$parent_stat  = $has_parent ? @stat( $parent ) : false;
+	if ( false !== $parent_stat ) {
+		$parent_mode  = $parent_stat['mode']; // Get parent directory inode protection mode.
+		$target_perms = $parent_mode & 0007777; // Get permission bits.
 	}
+	@chmod( $target, $target_perms );
 
-	// If the above failed, attempt to create the parent node, then try again.
-	if ( ( $target != '/' ) && ( wp_mkdir_p( dirname( $target ) ) ) )
-		return wp_mkdir_p( $target );
-
-	return false;
+	return true;
 }
 
 /**
