Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2021-03-15 17:30:04 +0300
committerAndrei Vagin <avagin@gmail.com>2021-09-03 20:31:00 +0300
commit248b7736765890650cea791615fcb350206f3d45 (patch)
treeb9c783e0d86bf4ed00a1b868c2a3d6b9eb61d218 /lib
parentabe3405b2078245825dbc0872defda059a66fb1c (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.py6
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)