Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

test makefiles: fix crash if --min-file-size <= --max-file-size

Nick Craig-Woodf583b8633429
diff --git a/cmd/test/makefiles/makefiles.go b/cmd/test/makefiles/makefiles.go
index ac8e2041d..26263e56a 100644
--- a/cmd/test/makefiles/makefiles.go
+++ b/cmd/test/makefiles/makefiles.go
@@ -88,7 +88,10 @@ var makefilesCmd = &cobra.Command{
totalBytes := int64(0)
for i := 0; i < numberOfFiles; i++ {
dir := dirs[randSource.Intn(len(dirs))]
- size := randSource.Int63n(int64(maxFileSize-minFileSize)) + int64(minFileSize)
+ size := int64(minFileSize)
+ if maxFileSize > minFileSize {
+ size += randSource.Int63n(int64(maxFileSize - minFileSize))
+ }
writeFile(dir, fileName(), size)
totalBytes += size
}
@@ -149,6 +152,9 @@ func commonInit() {
default:
source = randSource
}
+ if minFileSize > maxFileSize {
+ maxFileSize = minFileSize
+ }
}
type zeroReader struct{}