2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

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>
This commit is contained in:
Andrey Vagin
2014-10-14 15:38:00 +04:00
committed by Pavel Emelyanov
parent 2464ad08d6
commit db8ff58f52

View File

@@ -269,6 +269,11 @@ static unsigned int __get_ns_id(int pid, struct ns_desc *nd, struct ns_id **ns)
sprintf(ns_path, "ns/%s", nd->str);
ret = readlinkat(proc_dir, ns_path, ns_id, sizeof(ns_id));
if (ret < 0) {
if (errno == ENOENT) {
/* The namespace is unsupported */
kid = 0;
goto out;
}
pr_perror("Can't readlink ns link");
return 0;
}
@@ -276,6 +281,7 @@ static unsigned int __get_ns_id(int pid, struct ns_desc *nd, struct ns_id **ns)
kid = parse_ns_link(ns_id, ret, nd);
BUG_ON(!kid);
out:
return generate_ns_id(pid, kid, nd, ns);
}