Commit 72439b9f by Michel Normand Committed by Daniel Lezcano

close also inherited fd in lxc-execute

This is a complement of previous patches d983b93c and af795875 about inherited fd. Here this is required for the lxc-execute that have a specific lxc-init procress. Signed-off-by: 's avatarMichel Normand <normand@fr.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent c8c9ce7a
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
#include <sys/mount.h> #include <sys/mount.h>
#define _GNU_SOURCE #define _GNU_SOURCE
#include <getopt.h> #include <getopt.h>
#include "log.h" #include "lxc.h"
#include "error.h"
lxc_log_define(lxc_init, lxc); lxc_log_define(lxc_init, lxc);
...@@ -59,6 +58,8 @@ static int mount_fs(const char *source, const char *target, const char *type) ...@@ -59,6 +58,8 @@ static int mount_fs(const char *source, const char *target, const char *type)
return -1; return -1;
} }
DEBUG("'%s' mounted on '%s'", source, target);
return 0; return 0;
} }
...@@ -66,6 +67,7 @@ static inline int setup_fs(void) ...@@ -66,6 +67,7 @@ static inline int setup_fs(void)
{ {
if (mount_fs("proc", "/proc", "proc")) if (mount_fs("proc", "/proc", "proc"))
return -1; return -1;
if (mount_fs("shmfs", "/dev/shm", "tmpfs")) if (mount_fs("shmfs", "/dev/shm", "tmpfs"))
return -1; return -1;
...@@ -114,11 +116,19 @@ int main(int argc, char *argv[]) ...@@ -114,11 +116,19 @@ int main(int argc, char *argv[])
if (setup_fs()) if (setup_fs())
exit(err); exit(err);
NOTICE("about to exec '%s'", aargv[0]);
execvp(aargv[0], aargv); execvp(aargv[0], aargv);
ERROR("failed to exec: '%s' : %s", aargv[0], strerror(errno)); ERROR("failed to exec: '%s' : %s", aargv[0], strerror(errno));
exit(err); exit(err);
} }
err = lxc_close_all_inherited_fd();
if (err) {
ERROR("unable to close inherited fds");
goto out;
}
err = 0; err = 0;
for (;;) { for (;;) {
int status; int status;
......
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