2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

crit: fix error on memfd files parsing

Else we get error:

[root@fedora criu]# crit/crit x test/dump/zdtm/static/memfd00/56/1/ mems
...
Traceback (most recent call last):
  File "/home/snorch/devel/ms/criu/crit/crit", line 6, in <module>
    cli.main()
  File "/home/snorch/devel/ms/criu/crit/pycriu/cli.py", line 430, in main
    opts["func"](opts)
  File "/home/snorch/devel/ms/criu/crit/pycriu/cli.py", line 361, in explore
    explorers[opts['what']](opts)
  File "/home/snorch/devel/ms/criu/crit/pycriu/cli.py", line 283, in explore_mems
    fn = ' ' + get_file_str(opts, {
  File "/home/snorch/devel/ms/criu/crit/pycriu/cli.py", line 214, in get_file_str
    f = ft['get'](opts, ft, fd['id'])
  File "/home/snorch/devel/ms/criu/crit/pycriu/cli.py", line 165, in ftype_reg
    rf = ftype_find_in_image(opts, ft, fid, 'reg-files.img')
  File "/home/snorch/devel/ms/criu/crit/pycriu/cli.py", line 154, in ftype_find_in_image
    return f[ft['field']]
KeyError: 'reg'

Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
Pavel Tikhomirov
2021-07-02 16:52:13 +03:00
committed by Andrei Vagin
parent f57e45df56
commit 2ebb1c7419

View File

@@ -151,7 +151,10 @@ def ftype_find_in_files(opts, ft, fid):
def ftype_find_in_image(opts, ft, fid, img):
f = ftype_find_in_files(opts, ft, fid)
if f:
return f[ft['field']]
if ft['field'] in f:
return f[ft['field']]
else:
return None
if ft['img'] is None:
ft['img'] = pycriu.images.load(dinf(opts, img))['entries']