files: Correctly handle tasks with no open file descriptors

Do not fail, if task doesn't have open files. This fixes
zdtm/static/fd test, which is broken now:

(00.004411) Error (cr-dump.c:1312): Dump files (pid: 25) failed with -1
(00.004548) Error (cr-dump.c:1614): Dumping FAILED.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Kirill Tkhai 2016-04-18 18:11:00 +03:00 committed by Pavel Emelyanov
parent cabfbbef36
commit 2bf231496f

View file

@ -481,6 +481,7 @@ int dump_task_files_seized(struct parasite_ctl *ctl, struct pstree_item *item,
if (!img)
goto err;
ret = 0; /* Don't fail if nr_fds == 0 */
for (off = 0; off < dfds->nr_fds; off += nr_fds) {
if (nr_fds + off > dfds->nr_fds)
nr_fds = dfds->nr_fds - off;