Modify GetSymLinkStr for platforms that return ERANGE when buffer is too small, like HP_UX; tweak field splitting in crc32 test-harness test, for platforms that separate cksum fields with tabs, like Solaris 10 & maybe earlier.

This commit is contained in:
Brian Cox 2017-09-06 12:25:52 -07:00
parent 159e735ebc
commit 03bca0ebd4
2 changed files with 11 additions and 1 deletions

View File

@ -99,7 +99,15 @@ bool cFSPropCalc::GetSymLinkStr(const TSTRING& strName, cArchive& arch, size_t s
#endif
if(rtn == -1)
{
// Some OSes (like HP-UX) return ERANGE if buffer is too small.
// This is nonstandard but better than the usual truncate-and-say-you-succeeded
//
if(ERANGE == errno)
return GetSymLinkStr(strName, arch, size*2);
return false;
}
//Sadly if buf isn't big enough readlink 'succeeds' by truncating the string, so the only
// clue your buffer might be too small is if you maxed it out. So we try again, within reason.

View File

@ -34,8 +34,10 @@ sub run() {
printf("%-30s", "-- $description");
# lets see if the system 'cksum' agree's with siggen's crc32 value
# Doing split with ' ' instead of / / because some flavors of cksum
# like to separate fields with tabs, as seen on Solaris 10.
#
my ($crc32, undef) = split(/ /, `cksum $twtools::twrootdir/test`);
my ($crc32, undef) = split(' ', `cksum $twtools::twrootdir/test`);
if ($crc32 eq "") {
++$twtools::twskippedtests;