Skip to content

Commit

Permalink
fix build on go > 1.8.x
Browse files Browse the repository at this point in the history
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
  • Loading branch information
runcom committed Jul 25, 2017
1 parent 948db96 commit b5e3294
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
13 changes: 11 additions & 2 deletions api/server/middleware/audit_linux.go
Expand Up @@ -82,8 +82,17 @@ func getFdFromWriter(w http.ResponseWriter) int {
return -1
}
sysfd := netfd.FieldByName("sysfd")
//Finally, we have the fd
return int(sysfd.Int())
if sysfd.IsValid() {
// go < 1.9
return int(sysfd.Int())
}
pfd := netfd.FieldByName("pfd")
if pfd.Kind() != reflect.Struct {
logrus.Warnf("could not get underlying pfd struct")
return -1
}
newSysfd := pfd.FieldByName("Sysfd")
return int(newSysfd.Int())
}

//Gets the ucred given an http response writer
Expand Down
5 changes: 3 additions & 2 deletions daemon/graphdriver/devmapper/deviceset.go
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/go-units"
pkgerr "github.com/pkg/errors"

"github.com/opencontainers/runc/libcontainer/label"
)
Expand Down Expand Up @@ -2717,10 +2718,10 @@ func NewDeviceSet(root string, doInit bool, options []string, uidMaps, gidMaps [
case "dm.libdm_log_level":
level, err := strconv.ParseInt(val, 10, 32)
if err != nil {
return nil, errors.Wrapf(err, "could not parse `dm.libdm_log_level=%s`", val)
return nil, pkgerr.Wrapf(err, "could not parse `dm.libdm_log_level=%s`", val)
}
if level < devicemapper.LogLevelFatal || level > devicemapper.LogLevelDebug {
return nil, errors.Errorf("dm.libdm_log_level must be in range [%d,%d]", devicemapper.LogLevelFatal, devicemapper.LogLevelDebug)
return nil, pkgerr.Errorf("dm.libdm_log_level must be in range [%d,%d]", devicemapper.LogLevelFatal, devicemapper.LogLevelDebug)
}
// Register a new logging callback with the specified level.
devicemapper.LogInit(devicemapper.DefaultLogger{
Expand Down

0 comments on commit b5e3294

Please sign in to comment.