Merge pull request #609 from mrunalp/minor_fixes
Add missing error checks and simplify bool check
This commit is contained in:
commit
b01a7719cb
2 changed files with 8 additions and 4 deletions
|
@ -290,7 +290,7 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("invalid --cpu-profile value %q", err)
|
return fmt.Errorf("invalid --cpu-profile value %q", err)
|
||||||
}
|
}
|
||||||
pprof.StartCPUProfile(f)
|
_ = pprof.StartCPUProfile(f)
|
||||||
defer pprof.StopCPUProfile()
|
defer pprof.StopCPUProfile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,9 @@ func addOCIBindMounts(sb *sandbox, containerConfig *pb.ContainerConfig, specgen
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(src); err != nil && os.IsNotExist(err) {
|
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"}
|
options := []string{"rw"}
|
||||||
|
@ -455,7 +457,7 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
||||||
specgen.SetLinuxMountLabel(sb.mountLabel)
|
specgen.SetLinuxMountLabel(sb.mountLabel)
|
||||||
|
|
||||||
if containerConfig.GetLinux().GetSecurityContext() != nil &&
|
if containerConfig.GetLinux().GetSecurityContext() != nil &&
|
||||||
containerConfig.GetLinux().GetSecurityContext().Privileged == false {
|
!containerConfig.GetLinux().GetSecurityContext().Privileged {
|
||||||
for _, mp := range []string{
|
for _, mp := range []string{
|
||||||
"/proc/kcore",
|
"/proc/kcore",
|
||||||
"/proc/latency_stats",
|
"/proc/latency_stats",
|
||||||
|
@ -605,7 +607,9 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
os.MkdirAll(fp, 0644)
|
if err1 := os.MkdirAll(fp, 0644); err1 != nil {
|
||||||
|
return nil, err1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
processArgs, err := buildOCIProcessArgs(containerConfig, containerImageConfig)
|
processArgs, err := buildOCIProcessArgs(containerConfig, containerImageConfig)
|
||||||
|
|
Loading…
Reference in a new issue