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

Commit eb5ffb1

Browse files
author
Damien Lespiau
committed
destroy: Don't kill neither the init process nor hyperstart
When hyperstart isn't run as the init process, we need to prevent the daemon from killing itself. We never try to kill init, bad things can happen then. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
1 parent 5f819c5 commit eb5ffb1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/init.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,17 +132,23 @@ static void hyper_term_all(struct hyper_pod *pod)
132132
struct dirent *de;
133133
pid_t *pids = NULL;
134134
struct hyper_exec *e;
135+
pid_t hyperstart_pid;
135136

136137
dp = opendir("/proc");
137138
if (dp == NULL)
138139
return;
139140

141+
142+
hyperstart_pid = getpid();
143+
140144
while ((de = readdir(dp)) && de != NULL) {
141145
if (!isdigit(de->d_name[0]))
142146
continue;
143147
pid = atoi(de->d_name);
144148
if (pid == 1)
145149
continue;
150+
if (pid == hyperstart_pid)
151+
continue;
146152
if (index <= npids) {
147153
pids = realloc(pids, npids + 16384);
148154
if (pids == NULL)

0 commit comments

Comments
 (0)