Skip to content

Commit

Permalink
Declare structs
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Jackson <[email protected]>
  • Loading branch information
Martin Jackson committed Nov 29, 2022
1 parent 3661eb6 commit 0d8baac
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build linux && cgo && libsubid
// +build linux,cgo,libsubid

/*
* Copyright © 2019 – 2022 Red Hat Inc.
*
Expand Down Expand Up @@ -39,7 +36,6 @@ struct subid_range get_range(struct subid_range *ranges, int i)
import "C"

import (
"bufio"
"errors"
"fmt"
"io/ioutil"
Expand Down Expand Up @@ -89,6 +85,13 @@ type exitError struct {
err error
}

type subIDRange struct {
Start int
Length int
}

type ranges []subIDRange

func (e *exitError) Error() string {
if e.err != nil {
return e.err.Error()
Expand Down Expand Up @@ -418,6 +421,8 @@ func setUpLoggers() error {
func validateSubIDRange(username string, isUser bool) (ranges, error) {
var ret ranges

queryType := ""

if isUser {
queryType = "subuid"
} else {
Expand Down Expand Up @@ -467,7 +472,7 @@ func validateSubIDRange(username string, isUser bool) (ranges, error) {
ret = append(ret, newRange)

logrus.Debugf("Found %s range %d for %s: start [%d] length [%d]",
querytype,
queryType,
i,
username,
r.start,
Expand Down

0 comments on commit 0d8baac

Please sign in to comment.