MDL-48556 backup: Use correct conditions before checking dir permissions