Commit 5a211571 by dlezcano

Fix forked process should exit instead of returning on error

parent 2a87f764
...@@ -121,11 +121,12 @@ int lxc_execute(const char *name, int argc, char *argv[], ...@@ -121,11 +121,12 @@ int lxc_execute(const char *name, int argc, char *argv[],
goto error; goto error;
} }
if (mount("sysfs", "/sys", "sysfs", 0, NULL)) { if (conf_has_network(name))
lxc_log_syserror("failed to mount '/sys'"); if (mount("sysfs", "/sys", "sysfs", 0, NULL)) {
/* continue: non fatal error until sysfs not per lxc_log_syserror("failed to mount '/sys'");
namespace */ /* continue: non fatal error until sysfs not per
} namespace */
}
if (preexec) if (preexec)
if (preexec(name, argc, argv, data)) { if (preexec(name, argc, argv, data)) {
...@@ -134,12 +135,12 @@ int lxc_execute(const char *name, int argc, char *argv[], ...@@ -134,12 +135,12 @@ int lxc_execute(const char *name, int argc, char *argv[],
} }
execvp(argv[0], argv); execvp(argv[0], argv);
error:
lxc_log_syserror("failed to exec %s", argv[0]); lxc_log_syserror("failed to exec %s", argv[0]);
error:
if (write(sv[0], &sync, sizeof(sync)) < 0) if (write(sv[0], &sync, sizeof(sync)) < 0)
lxc_log_syserror("failed to write the socket"); lxc_log_syserror("failed to write the socket");
return 1; exit(1);
} }
setsid(); setsid();
......
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