Skip to content

Commit

Permalink
Fix file mode preservation during untar if mtime=0 (#274)
Browse files Browse the repository at this point in the history
This commit fixes file mode preservation after `desync tar --no-time` and `desync untar`.
  • Loading branch information
matshch authored Nov 30, 2024
1 parent 6c5d7aa commit d657226
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions localfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ func (fs *LocalFS) CreateFile(n NodeFile) error {
if _, err = io.Copy(f, n.Data); err != nil {
return err
}
if n.MTime == time.Unix(0, 0) {
return nil
}

if err := fs.SetFilePermissions(n); err != nil {
return err
}

if n.MTime == time.Unix(0, 0) {
return nil
}
return os.Chtimes(dst, n.MTime, n.MTime)
}

Expand Down

0 comments on commit d657226

Please sign in to comment.