Skip to content

Commit

Permalink
untar: mv store dirs into extract_file
Browse files Browse the repository at this point in the history
Signed-off-by: yuchen.cc <yuchen.cc@alibaba-inc.com>
  • Loading branch information
yuchen0cc committed Jan 26, 2024
1 parent 08847cf commit 7aa2ffe
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 7aa2ffe

Please sign in to comment.