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

criu-ns: Convert c_char_p strings to bytes object

class ctypes.c_char_p
    Represents the C char * datatype when it points to a zero-
    terminated string. For a general character pointer that may
    also point to binary data, POINTER(c_char) must be used.
    The constructor accepts an integer address, or a bytes object.

https://docs.python.org/3/library/ctypes.html#ctypes.c_char_p

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
Radostin Stoyanov
2019-04-07 20:55:32 +01:00
committed by Andrei Vagin
parent d16033658f
commit b2232f7f7a

View File

@@ -74,11 +74,11 @@ def wrap_restore():
os.close(r_pipe)
# Mount new /proc
if _mount(None, "/", None, MS_SLAVE|MS_REC, None) != 0:
if _mount(None, b"/", None, MS_SLAVE|MS_REC, None) != 0:
_errno = ctypes.get_errno()
raise OSError(_errno, errno.errorcode[_errno])
if _mount('proc', '/proc', 'proc', 0, None) != 0:
if _mount(b'proc', b'/proc', b'proc', 0, None) != 0:
_errno = ctypes.get_errno()
raise OSError(_errno, errno.errorcode[_errno])
@@ -98,7 +98,7 @@ def wrap_restore():
status = -251
break
os.write(w_pipe, "%d" % status)
os.write(w_pipe, b"%d" % status)
os.close(w_pipe)
if status != 0: