Fixes #9283. Consider hardlinks in image size.
Based on #8984. This patch fixes behavior when image size calculation didn't consider hardlinks. Signed-off-by: Dmitry Vorobev <dimahabr@gmail.com>
This commit is contained in:
parent
bc78380707
commit
f6ec5ae6ee
7 changed files with 73 additions and 10 deletions
|
@ -3,6 +3,7 @@
|
|||
package archive
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
|
||||
"github.com/docker/docker/pkg/system"
|
||||
|
@ -25,3 +26,11 @@ func statDifferent(oldStat *system.StatT, newStat *system.StatT) bool {
|
|||
func (info *FileInfo) isDir() bool {
|
||||
return info.parent == nil || info.stat.Mode()&syscall.S_IFDIR != 0
|
||||
}
|
||||
|
||||
func getIno(fi os.FileInfo) uint64 {
|
||||
return uint64(fi.Sys().(*syscall.Stat_t).Ino)
|
||||
}
|
||||
|
||||
func hasHardlinks(fi os.FileInfo) bool {
|
||||
return fi.Sys().(*syscall.Stat_t).Nlink > 1
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue