Skip to content

Commit 208a0f8

Browse files
authored
Merge pull request #1922 from StefanoBalzarottiNozomi/fix-infinite-loop
fix infinite loop
2 parents b952ecf + 34093fe commit 208a0f8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

disk/disk_windows.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
const (
2323
volumeNameBufferLength = uint32(windows.MAX_PATH + 1)
2424
volumePathBufferLength = volumeNameBufferLength
25+
maxWarningsInDrive = 5
2526
)
2627

2728
var (
@@ -172,6 +173,10 @@ func PartitionsWithContext(ctx context.Context, _ bool) ([]PartitionStat, error)
172173
break
173174
}
174175
warnings.Add(fmt.Errorf("failed to find next volume: %w", err))
176+
if len(warnings.List) > maxWarningsInDrive {
177+
break
178+
}
179+
175180
}
176181
}
177182
}

0 commit comments

Comments
 (0)