namespace: don't fail if a namespace isn't supported by kernel

CRIU reads /proc/pid/ns/[NS] and fails of a link is not exist.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
namespace: append a null byte after readlink

readlink() does not append a null byte to buf.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
namespaces: take into account USERNS id

and return an error, if a proccess live in another userns,
because criu doesn't support it.

Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
tty: Fix compilation warrning

 | tty.c: In function ‘tty_restore_ctl_terminal’:
 | include/criu-log.h:42:16: error: ‘index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

Same time assign CONSOLE_INDEX for debug info.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>