Merge pull request #609 from mrunalp/minor_fixes

Add missing error checks and simplify bool check
This commit is contained in:
Antonio Murdaca 2017-06-17 13:48:15 +02:00 committed by GitHub
commit b01a7719cb
2 changed files with 8 additions and 4 deletions

View file

@ -290,7 +290,7 @@ func main() {
if err != nil {
return fmt.Errorf("invalid --cpu-profile value %q", err)
}
pprof.StartCPUProfile(f)
_ = pprof.StartCPUProfile(f)
defer pprof.StopCPUProfile()
}

View file

@ -49,7 +49,9 @@ func addOCIBindMounts(sb *sandbox, containerConfig *pb.ContainerConfig, specgen
}
if _, err := os.Stat(src); err != nil && os.IsNotExist(err) {
os.MkdirAll(src, 0644)
if err1 := os.MkdirAll(src, 0644); err1 != nil {
return fmt.Errorf("Failed to mkdir %s: %s", src, err)
}
}
options := []string{"rw"}
@ -455,7 +457,7 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
specgen.SetLinuxMountLabel(sb.mountLabel)
if containerConfig.GetLinux().GetSecurityContext() != nil &&
containerConfig.GetLinux().GetSecurityContext().Privileged == false {
!containerConfig.GetLinux().GetSecurityContext().Privileged {
for _, mp := range []string{
"/proc/kcore",
"/proc/latency_stats",
@ -605,7 +607,9 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
if err != nil {
return nil, err
}
os.MkdirAll(fp, 0644)
if err1 := os.MkdirAll(fp, 0644); err1 != nil {
return nil, err1
}
}
processArgs, err := buildOCIProcessArgs(containerConfig, containerImageConfig)