Commit 9f53d717 by Daniel Lezcano Committed by Daniel Lezcano

lxc-attach gives a better error message

Don't assume the user knows the kernel internals :) Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent b09ecaf3
...@@ -102,6 +102,12 @@ int lxc_attach(pid_t pid) ...@@ -102,6 +102,12 @@ int lxc_attach(pid_t pid)
int fd[size]; int fd[size];
int i; 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++) { for (i = 0; i < size; i++) {
sprintf(path, "/proc/%d/ns/%s", pid, ns[i]); sprintf(path, "/proc/%d/ns/%s", pid, ns[i]);
fd[i] = open(path, O_RDONLY); fd[i] = open(path, O_RDONLY);
......
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