This should be more efficient everywhere, and appears to be required on Solaris. Copied from master repository. From-SVN: r201637