From: Daniel Lezcano Date: Tue, 1 Feb 2011 10:42:29 +0000 (+0100) Subject: lxc-attach gives a better error message X-Git-Tag: lxc-0.7.4-rc1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f53d717c4fea7bb2a493d911da0abbe9c78aef5;p=thirdparty%2Flxc.git lxc-attach gives a better error message Don't assume the user knows the kernel internals :) Signed-off-by: Daniel Lezcano --- diff --git a/src/lxc/namespace.c b/src/lxc/namespace.c index 3905a0333..3a6db795b 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);