Merge pull request #125 from lifupan/fix_agent_crash

agent: fix the issue of crash agent without spec
This commit is contained in:
James O. D. Hunt 2020-01-20 11:29:16 +00:00 committed by GitHub
commit b5e741ba8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,15 @@ impl agentService {
let sandbox;
let mut s;
let oci = oci_spec.as_mut().unwrap();
let oci = match oci_spec.as_mut() {
Some(spec) => spec,
None => {
error!(sl!(), "no oci spec in the create container request!");
return Err(
ErrorKind::Nix(nix::Error::from_errno(nix::errno::Errno::EINVAL)).into(),
);
}
};
info!(sl!(), "receive createcontainer {}", &cid);