Use open+readlinkat() to avoid bumping access time on symlinks (where available)

This commit is contained in:
Brian Cox 2016-06-13 16:12:19 -07:00
parent 33f695c435
commit bf0c230404
1 changed files with 10 additions and 1 deletions

View File

@ -97,9 +97,18 @@ static bool GetSymLinkStr(const cFCOName& fileName, cArchive& arch)
#ifdef _UNICODE
#error GetSymLinkStr in fspropcalc.cpp is not unicode compliant
#else // ifdef _UNICODE
char buf[1024];
#if defined(O_PATH)
int fd = open(iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(),
(O_PATH | O_NOFOLLOW | O_NOATIME));
int rtn = readlinkat(fd, 0, buf, 1024);
close(fd);
#else
int rtn = readlink( iTWFactory::GetInstance()->GetNameTranslator()->ToStringAPI( fileName ).c_str(),
buf, 1024 );
buf, 1024 );
#endif
if(rtn == -1)
return false;