Skip to content

Commit c2fa2cb

Browse files
committed
Update comment
1 parent 34da06e commit c2fa2cb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

disk/disk_darwin.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ func PartitionsWithContext(ctx context.Context, all bool) ([]PartitionStat, erro
2424
if err != nil {
2525
return ret, err
2626
}
27-
fs = fs[:count] // Actual count may be less than from the first call.
27+
// On 10.14, and possibly other OS versions, the actual count may
28+
// be less than from the first call. Truncate to the returned count
29+
// to prevent accessing uninitialized entries.
30+
fs = fs[:count]
2831
for _, stat := range fs {
2932
opts := []string{"rw"}
3033
if stat.Flags&unix.MNT_RDONLY != 0 {

0 commit comments

Comments
 (0)