diff options
author | Daniel Lezcano <daniel.lezcano@free.fr> | 2011-02-01 11:42:29 +0100 |
---|---|---|
committer | Daniel Lezcano <dlezcano@fr.ibm.com> | 2011-02-01 11:42:29 +0100 |
commit | 9f53d717c4fea7bb2a493d911da0abbe9c78aef5 (patch) | |
tree | 7c84d83cdb3f6218f863cf6ce93c35c3a8c69014 | |
parent | Fix paths in the lxc-busybox template (diff) | |
download | lxc-9f53d717c4fea7bb2a493d911da0abbe9c78aef5.tar.gz lxc-9f53d717c4fea7bb2a493d911da0abbe9c78aef5.tar.bz2 lxc-9f53d717c4fea7bb2a493d911da0abbe9c78aef5.zip |
lxc-attach gives a better error message
Don't assume the user knows the kernel internals :)
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r-- | src/lxc/namespace.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lxc/namespace.c b/src/lxc/namespace.c index 3905a03..3a6db79 100644 --- a/src/lxc/namespace.c +++ b/src/lxc/namespace.c @@ -102,6 +102,12 @@ int lxc_attach(pid_t pid) int fd[size]; int i; + sprintf(path, "/proc/%d/ns", pid); + if (access(path, R_OK)) { + ERROR("Does this kernel version support 'attach' ?"); + return -1; + } + for (i = 0; i < size; i++) { sprintf(path, "/proc/%d/ns/%s", pid, ns[i]); fd[i] = open(path, O_RDONLY); |