mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +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:
committed by
Pavel Emelyanov
parent
2464ad08d6
commit
db8ff58f52
@@ -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);
|
sprintf(ns_path, "ns/%s", nd->str);
|
||||||
ret = readlinkat(proc_dir, ns_path, ns_id, sizeof(ns_id));
|
ret = readlinkat(proc_dir, ns_path, ns_id, sizeof(ns_id));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
if (errno == ENOENT) {
|
||||||
|
/* The namespace is unsupported */
|
||||||
|
kid = 0;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
pr_perror("Can't readlink ns link");
|
pr_perror("Can't readlink ns link");
|
||||||
return 0;
|
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);
|
kid = parse_ns_link(ns_id, ret, nd);
|
||||||
BUG_ON(!kid);
|
BUG_ON(!kid);
|
||||||
|
|
||||||
|
out:
|
||||||
return generate_ns_id(pid, kid, nd, ns);
|
return generate_ns_id(pid, kid, nd, ns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user