Commit 5d7cfa8f authored by Pavel Emelyanov's avatar Pavel Emelyanov

sk: Don't fail collect_sockets in non netns case

This is already so, just move the check for netns case
into collect_sockets. It knows it does so.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 15058157
......@@ -1755,17 +1755,9 @@ int cr_dump_tasks(pid_t pid, const struct cr_options *opts)
if (mntns_collect_root(root_item->pid.real))
goto err;
ret = collect_sockets(pid);
/*
* If netns isn't dumped, crtools will fail only
* if an unsupported socket will be really dumped.
*/
if ((current_ns_mask & CLONE_NEWNET) && ret)
if (collect_sockets(pid))
goto err;
ret = -1;
glob_fdset = cr_glob_fdset_open(O_DUMP);
if (!glob_fdset)
goto err;
......
......@@ -521,8 +521,18 @@ int collect_sockets(int pid)
close(nl);
out:
if (rst >= 0 && restore_ns(rst, &net_ns_desc) < 0)
err = -1;
if (rst >= 0) {
if (restore_ns(rst, &net_ns_desc) < 0)
err = -1;
} else {
/*
* If netns isn't dumped, crtools will fail only
* if an unsupported socket will be really dumped.
*/
pr_info("Uncollected sockets! Will probably fail later.\n");
err = 0;
}
return err;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment