]> git.proxmox.com Git - mirror_lxc.git/commitdiff
lxc-attach gives a better error message
authorDaniel Lezcano <daniel.lezcano@free.fr>
Tue, 1 Feb 2011 10:42:29 +0000 (11:42 +0100)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Tue, 1 Feb 2011 10:42:29 +0000 (11:42 +0100)
Don't assume the user knows the kernel internals :)

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/namespace.c

index 3905a033336ed73f757a57bbfb7d463e57c666c2..3a6db795b96a02b4008410729393f5df6a965b6d 100644 (file)
@@ -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);