Fix compilers seeing empty input due to file system races (#4708).

This commit is contained in:
Wilson Snyder
2023-11-21 21:22:35 -05:00
parent ed05caec93
commit b15ef49c57
7 changed files with 41 additions and 21 deletions
+2 -2
View File
@@ -191,7 +191,7 @@ void V3FileDependImp::writeTimes(const string& filename, const string& cmdlineIn
// Read stats of files we create after we're done making them
// (except for this file, of course)
DependFile* const dfp = const_cast<DependFile*>(&(*iter));
V3Options::fileNfsFlush(dfp->filename());
V3Os::filesystemFlush(dfp->filename());
dfp->loadStats();
off_t showSize = iter->size();
ino_t showIno = iter->ino();
@@ -256,7 +256,7 @@ bool V3FileDependImp::checkTimes(const string& filename, const string& cmdlineIn
*ifp >> quote;
const string chkFilename = V3Os::getline(*ifp, '"');
V3Options::fileNfsFlush(chkFilename);
V3Os::filesystemFlush(chkFilename);
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
struct stat chkStat;
const int err = stat(chkFilename.c_str(), &chkStat);