Merge pull request #1130 from crrodriguez/checkInPingGroupBugs

fix checkInPingGroup bugs
This commit is contained in:
chungthuang 2024-04-02 10:24:51 -05:00 committed by GitHub
commit b723a1a426
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 5 deletions

View File

@ -78,19 +78,19 @@ func checkInPingGroup() error {
if err != nil { if err != nil {
return err return err
} }
groupID := os.Getgid() groupID := uint64(os.Getegid())
// Example content: 999 59999 // Example content: 999 59999
found := findGroupIDRegex.FindAll(file, 2) found := findGroupIDRegex.FindAll(file, 2)
if len(found) == 2 { if len(found) == 2 {
groupMin, err := strconv.ParseInt(string(found[0]), 10, 32) groupMin, err := strconv.ParseUint(string(found[0]), 10, 32)
if err != nil { if err != nil {
return errors.Wrapf(err, "failed to determine minimum ping group ID") return errors.Wrapf(err, "failed to determine minimum ping group ID")
} }
groupMax, err := strconv.ParseInt(string(found[1]), 10, 32) groupMax, err := strconv.ParseUint(string(found[1]), 10, 32)
if err != nil { if err != nil {
return errors.Wrapf(err, "failed to determine minimum ping group ID") return errors.Wrapf(err, "failed to determine maximum ping group ID")
} }
if groupID < int(groupMin) || groupID > int(groupMax) { if groupID < groupMin || groupID > groupMax {
return fmt.Errorf("Group ID %d is not between ping group %d to %d", groupID, groupMin, groupMax) return fmt.Errorf("Group ID %d is not between ping group %d to %d", groupID, groupMin, groupMax)
} }
return nil return nil