Skip to content

Commit

Permalink
[bug] Fix cleaning cache failed (#6100)
Browse files Browse the repository at this point in the history
Issue: fixes #6081
  • Loading branch information
PGZXB authored Sep 19, 2022
1 parent 88f030e commit bf365c7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions taichi/runtime/llvm/llvm_offline_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ bool LlvmOfflineCacheFileReader::load_meta_data(
using Error = offline_cache::LoadMetadataError;
const auto tcb_path = get_llvm_cache_metadata_file_path(cache_file_path);

if (!taichi::path_exists(tcb_path)) {
TI_DEBUG("File {} not found", tcb_path);
return false;
}

if (!with_lock) {
return Error::kNoError == load_metadata_with_checking(data, tcb_path);
}
Expand Down
6 changes: 3 additions & 3 deletions taichi/util/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ inline bool traverse_directory(const std::string &dir, Visitor v) {
return false;
}
while ((f = ::readdir(directory))) {
struct stat *stat_buf = nullptr;
auto fullpath = join_path(dir, f->d_name);
auto ret = ::stat(fullpath.c_str(), stat_buf);
struct stat stat_buf;
auto ret = ::stat(fullpath.c_str(), &stat_buf);
TI_ASSERT(ret == 0);
v(f->d_name, S_ISDIR(stat_buf->st_mode));
v(f->d_name, S_ISDIR(stat_buf.st_mode));
}
auto ret = ::closedir(directory);
TI_ASSERT(ret == 0);
Expand Down

0 comments on commit bf365c7

Please sign in to comment.