diff options
author | Adrian Reber <areber@redhat.com> | 2021-03-15 17:30:04 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2021-09-03 20:31:00 +0300 |
commit | 248b7736765890650cea791615fcb350206f3d45 (patch) | |
tree | b9c783e0d86bf4ed00a1b868c2a3d6b9eb61d218 /lib | |
parent | abe3405b2078245825dbc0872defda059a66fb1c (diff) |
lib: correctly handle padding of dump images
With the switch to Python3 and binary output it is not possible to use
code like: 'f.write('\0' * (rounded - size))'. Switching to binary
helps.
Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/py/images/images.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/py/images/images.py b/lib/py/images/images.py index c854c6152..e4f9ca3d4 100644 --- a/lib/py/images/images.py +++ b/lib/py/images/images.py @@ -390,7 +390,7 @@ class ipc_sem_set_handler: if len(s) != entry['nsems']: raise Exception("Number of semaphores mismatch") f.write(s.tobytes()) - f.write('\0' * (rounded - size)) + f.write(b'\0' * (rounded - size)) def skip(self, f, pbuff): entry = pb2dict.pb2dict(pbuff) @@ -428,7 +428,7 @@ class ipc_msg_queue_handler: rounded = round_up(msg.msize, sizeof_u64) data = base64.decodebytes(extra[i + 1]) f.write(data[:msg.msize]) - f.write('\0' * (rounded - msg.msize)) + f.write(b'\0' * (rounded - msg.msize)) def skip(self, f, pbuff): entry = pb2dict.pb2dict(pbuff) @@ -462,7 +462,7 @@ class ipc_shm_handler: data = base64.decodebytes(extra) rounded = round_up(size, sizeof_u32) f.write(data[:size]) - f.write('\0' * (rounded - size)) + f.write(b'\0' * (rounded - size)) def skip(self, f, pbuff): entry = pb2dict.pb2dict(pbuff) |