Update comment

This commit is contained in:
Brian Ryner 2022-12-18 14:23:01 +11:00
parent 34da06e9b7
commit c2fa2cbf8e
1 changed files with 4 additions and 1 deletions

View File

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