From 3d47ab68dd0743df1287f6953e5c297f9d8b7a5f Mon Sep 17 00:00:00 2001 From: Daniel Milde Date: Tue, 16 Feb 2021 20:14:24 +0100 Subject: [PATCH] fixed data race in flag propagation --- analyze/dir.go | 9 --------- analyze/file.go | 7 +++++++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/analyze/dir.go b/analyze/dir.go index b36328587..865bb0cd8 100644 --- a/analyze/dir.go +++ b/analyze/dir.go @@ -87,16 +87,7 @@ func processDir(path string, progress *CurrentProgress, concurrencyLimitChannel subdir.Parent = &dir mutex.Lock() - dir.Files = append(dir.Files, subdir) - - switch subdir.Flag { - case '!', '.': - if dir.Flag != '!' { - dir.Flag = '.' - } - } - mutex.Unlock() <-concurrencyLimitChannel diff --git a/analyze/file.go b/analyze/file.go index e6f1ecfdd..3c9b80bf8 100644 --- a/analyze/file.go +++ b/analyze/file.go @@ -66,6 +66,13 @@ func (f *File) UpdateStats(links AlreadyCountedHardlinks) { entry.UpdateStats(links) } + switch entry.Flag { + case '!', '.': + if f.Flag != '!' { + f.Flag = '.' + } + } + itemCount += entry.ItemCount if entry.MutliLinkInode > 0 {