-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix nil deference #494
fix nil deference #494
Conversation
cmd/runtimetest/main.go
Outdated
@@ -178,7 +182,7 @@ func validateCapabilities(spec *rspec.Spec) error { | |||
expectedCaps3 := make(map[string]bool) | |||
expectedCaps4 := make(map[string]bool) | |||
expectedCaps5 := make(map[string]bool) | |||
if spec.Process.Capabilities != nil { | |||
if spec.Process != nil && spec.Process.Capabilities != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather move this guard to the top of this function, and have:
if spec.Process == nil || spec.Process.Capabilities == nil {
return nil
}
I don't see the point to initializing processCaps
, etc. when we aren't going to use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, thanks.
Signed-off-by: zhouhao <[email protected]>
1babd18
to
6d2dbbc
Compare
Signed-off-by: zhouhao <[email protected]>
440fad4
to
19b061c
Compare
1 similar comment
6d2dbbc (runtimetest: fix nil deference, 2017-10-11, opencontainers#494) put the nil-Process guard in, but it was a bit too coarse. We can still run these tests with a nil Process, because all we need Process for is deciding whether or not to include /dev/console. Signed-off-by: W. Trevor King <[email protected]>
Signed-off-by: zhouhao [email protected]