mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 02:15:43 +03:00
Avoiding copying files if they are already present in chrootw (#1753)
This commit is contained in:
committed by
GitHub
parent
ec9e395b27
commit
50e3217211
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user