Skip to content

Commit

Permalink
Merge pull request #312 from yuchen0cc/main
Browse files Browse the repository at this point in the history
untar: mv store dirs into extract_file
  • Loading branch information
liulanzheng authored Jan 26, 2024
2 parents 08847cf + 7aa2ffe commit 41bc0db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/overlaybd/tar/libtar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,6 @@ int UnTar::extract_all() {
if (extract_file(filename.c_str()) != 0) {
LOG_ERRNO_RETURN(0, -1, "extract failed, filename `", filename);
}
if (TH_ISDIR(header)) {
dirs.emplace_back(std::make_pair(filename, header.get_mtime()));
}
count++;
}

Expand Down Expand Up @@ -230,7 +227,11 @@ int UnTar::extract_file(const char *filename) {
if (i != 0) {
return i;
}

// Directory mtimes must be handled at the end to avoid further
// file creation in them to modify the directory mtime
if (TH_ISDIR(header)) {
dirs.emplace_back(std::make_pair(filename, header.get_mtime()));
}
unpackedPaths.insert(filename);
return 0;
}
Expand Down

0 comments on commit 41bc0db

Please sign in to comment.