Index: wp-includes/functions.php
===================================================================
--- wp-includes/functions.php	(revision 15076)
+++ wp-includes/functions.php	(working copy)
@@ -2031,7 +2031,9 @@
 	if ( @mkdir( $target ) ) {
 		$stat = @stat( dirname( $target ) );
 		$dir_perms = $stat['mode'] & 0007777;  // Get the permission bits.
-		@chmod( $target, $dir_perms );
+		if( ( $dir_perms & 0007000 ) == 0 || ! ini_get('safe_mode') ) { // Cannot set the SUID, SGID and sticky bits in safe mode
+		  @chmod( $target, $dir_perms );
+		}
 		return true;
 	} elseif ( is_dir( dirname( $target ) ) ) {
 			return false;
