summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fsck.go18
1 files changed, 3 insertions, 15 deletions
diff --git a/fsck.go b/fsck.go
index 1f40514..388071f 100644
--- a/fsck.go
+++ b/fsck.go
@@ -8,7 +8,7 @@ import (
"os"
"os/signal"
"path/filepath"
- "strings"
+ "sort"
"sync"
"syscall"
@@ -96,6 +96,8 @@ func (ck *fsckObj) dir(relPath string) {
ck.markCorrupt(relPath)
return
}
+ // Sort alphabetically to make fsck runs deterministic
+ sort.Strings(entries)
for _, entry := range entries {
if ck.abort {
return
@@ -321,20 +323,6 @@ func fsck(args *argContainer) (exitcode int) {
return exitcodes.FsckErrors
}
-type sortableDirEntries []fuse.DirEntry
-
-func (s sortableDirEntries) Len() int {
- return len(s)
-}
-
-func (s sortableDirEntries) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
-}
-
-func (s sortableDirEntries) Less(i, j int) bool {
- return strings.Compare(s[i].Name, s[j].Name) < 0
-}
-
func inum(f *os.File) uint64 {
var st syscall.Stat_t
err := syscall.Fstat(int(f.Fd()), &st)