Commit 96c9f969 by dlezcano

Exit instead of returning in the child processes, otherwise the execution

path of the child will be wrong in case of error.
parent ae4c2547
...@@ -101,12 +101,12 @@ int lxc_execute(const char *name, int argc, char *argv[], ...@@ -101,12 +101,12 @@ int lxc_execute(const char *name, int argc, char *argv[],
if (write(sv[0], &sync, sizeof(sync)) < 0) { if (write(sv[0], &sync, sizeof(sync)) < 0) {
lxc_log_syserror("failed to write socket"); lxc_log_syserror("failed to write socket");
return 1; exit(1);
} }
if (read(sv[0], &sync, sizeof(sync)) < 0) { if (read(sv[0], &sync, sizeof(sync)) < 0) {
lxc_log_syserror("failed to read socket"); lxc_log_syserror("failed to read socket");
return 1; exit(1);
} }
if (lxc_setup(name)) { if (lxc_setup(name)) {
...@@ -156,11 +156,11 @@ int lxc_execute(const char *name, int argc, char *argv[], ...@@ -156,11 +156,11 @@ int lxc_execute(const char *name, int argc, char *argv[],
int status; int status;
if (wait(&status) < 0) { if (wait(&status) < 0) {
if (errno == ECHILD) if (errno == ECHILD)
return 0; exit(0);
if (errno == EINTR) if (errno == EINTR)
continue; continue;
lxc_log_syserror("failed to wait child"); lxc_log_syserror("failed to wait child");
return 1; exit(1);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment