Skip to content

Commit

Permalink
Avoiding copying files if they are already present in chrootw
Browse files Browse the repository at this point in the history
  • Loading branch information
diptanu committed Sep 27, 2016
1 parent ec9e395 commit 608ae51
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/allocdir/alloc_dir_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ var (
)

func (d *AllocDir) linkOrCopy(src, dst string, perm os.FileMode) error {
// Avoid link/copy if the file already exists in the chroot
// TODO 0.6 clean this up. This was needed because chroot creation fails
// when a process restarts.
if fileInfo, _ := os.Stat(dst); fileInfo != nil {
return nil
}
// Attempt to hardlink.
if err := os.Link(src, dst); err == nil {
return nil
Expand Down

0 comments on commit 608ae51

Please sign in to comment.