Skip to content

Commit

Permalink
make get and set work
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Downs <[email protected]>
  • Loading branch information
briandowns committed Sep 8, 2022
1 parent e7efa69 commit a073fcf
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jail.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,19 @@ func (j *jail) Clone() (int, error) {
}

// ID returns the JID of the corresponding jail.
func ID(name string) (int, error) {
func ID(name string) (int32, error) {
params := NewParams()
params.Add("name", name)

if err := Get(params, 0); err != nil {
return -1, err
}

return params["jid"].(int), nil
return params["jid"].(int32), nil
}

// Name returns the name of the corresponding jail.
func Name(id int) (string, error) {
func Name(id int32) (string, error) {
params := NewParams()
params.Add("jid", id)

Expand Down Expand Up @@ -279,7 +279,7 @@ func (p Params) Validate() error {
return nil
}

// buildIOVEC takes the containing map value and builds
// buildIovec takes the containing map value and builds
// out a slice of syscall.Iovec.
func (p Params) buildIovec() ([]syscall.Iovec, error) {
iovec := make([]syscall.Iovec, len(p))
Expand All @@ -290,8 +290,10 @@ func (p Params) buildIovec() ([]syscall.Iovec, error) {
if err != nil {
return nil, err
}

rv := reflect.ValueOf(v).Elem()
var size uint64

switch rv.Kind() {
case reflect.String:
s := string(rv.String())
Expand All @@ -307,6 +309,7 @@ func (p Params) buildIovec() ([]syscall.Iovec, error) {
Base: ib,
Len: size,
}

itr++
}

Expand Down

0 comments on commit a073fcf

Please sign in to comment.