Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit a325b7f

Browse files
committed
check conflicts when add new process
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
1 parent 3d53c5a commit a325b7f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/exec.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,17 @@ int hyper_exec_cmd(struct hyper_pod *pod, char *json, int length)
602602
return -1;
603603
}
604604

605+
if (hyper_find_container(pod, exec->container_id) == NULL) {
606+
fprintf(stderr, "call hyper_exec_cmd, no such container: %s\n", exec->container_id);
607+
hyper_free_exec(exec);
608+
return -1;
609+
}
610+
if (hyper_find_exec_by_name(pod, exec->id) != NULL) {
611+
fprintf(stderr, "call hyper_exec_cmd, process id conflicts");
612+
hyper_free_exec(exec);
613+
return -1;
614+
}
615+
605616
exec->pod = pod;
606617
int ret = hyper_run_process(exec);
607618
if (ret < 0) {

0 commit comments

Comments
 (0)