Make WordPress Core

Ticket #13659: wp_mkdir_p_p2.patch

File wp_mkdir_p_p2.patch, 634 bytes (added by cgrenier, 15 years ago)

Only call chmod if safe mode isn't used or sgid bit isn't set

  • wp-includes/functions.php

     
    20312031        if ( @mkdir( $target ) ) {
    20322032                $stat = @stat( dirname( $target ) );
    20332033                $dir_perms = $stat['mode'] & 0007777;  // Get the permission bits.
    2034                 @chmod( $target, $dir_perms );
     2034                if( ( $dir_perms & 0007000 ) == 0 || ! ini_get('safe_mode') ) { // Cannot set the SUID, SGID and sticky bits in safe mode
     2035                  @chmod( $target, $dir_perms );
     2036                }
    20352037                return true;
    20362038        } elseif ( is_dir( dirname( $target ) ) ) {
    20372039                        return false;