From d0476ea93b13f81ba63bef15ca6b0f168cdfa64a Mon Sep 17 00:00:00 2001 From: Andrey Vagin Date: Tue, 14 Aug 2012 12:49:21 +0400 Subject: [PATCH] sockets: fail if an unsupported socket is in a dumped netns If netns is dumped, crtools fails if it collects unsupported sockets. If netns isn't dumped, crtools will fail only if an unsupported socket should be dumped. Signed-off-by: Andrey Vagin Signed-off-by: Pavel Emelyanov --- cr-dump.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cr-dump.c b/cr-dump.c index cea69f285..690a79a55 100644 --- a/cr-dump.c +++ b/cr-dump.c @@ -1505,17 +1505,19 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts) if (collect_pstree(pid, opts)) goto err; - /* - * Ignore collection errors by now since we may not want - * to dump the missed sockets. But later, when we will start - * dumping containers, we'll better fail here, rather than - * in the dump stage - */ - if (mntns_collect_root(root_item->pid.real)) goto err; - collect_sockets(pid); + ret = collect_sockets(pid); + + /* + * If netns isn't dumped, crtools will fail only + * if an unsupported socket will be really dumped. + */ + if ((opts->namespaces_flags & CLONE_NEWNET) && ret) + goto err; + + ret = -1; glob_fdset = cr_glob_fdset_open(O_DUMP); if (!glob_fdset)