aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@free.fr>2011-02-01 11:42:29 +0100
committerDaniel Lezcano <dlezcano@fr.ibm.com>2011-02-01 11:42:29 +0100
commit9f53d717c4fea7bb2a493d911da0abbe9c78aef5 (patch)
tree7c84d83cdb3f6218f863cf6ce93c35c3a8c69014
parentFix paths in the lxc-busybox template (diff)
downloadlxc-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.c6
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);