summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xexamples/chrootfuse.py8
-rw-r--r--linuxnamespaces/syscalls.py6
2 files changed, 12 insertions, 2 deletions
diff --git a/examples/chrootfuse.py b/examples/chrootfuse.py
index 55a394e..ef67e8a 100755
--- a/examples/chrootfuse.py
+++ b/examples/chrootfuse.py
@@ -71,7 +71,13 @@ def main() -> None:
linuxnamespaces.MountFlags.RDONLY
if readonly
else linuxnamespaces.MountFlags.NONE,
- "fd=%d,rootmode=040755,user_id=0,group_id=0,allow_other" % fusefd,
+ [
+ "fd=%d" % fusefd,
+ "rootmode=040755",
+ "user_id=0",
+ "group_id=0",
+ "allow_other",
+ ],
)
os.chdir("/mnt")
linuxnamespaces.bind_mount("/proc", "proc", recursive=True)
diff --git a/linuxnamespaces/syscalls.py b/linuxnamespaces/syscalls.py
index 986238c..368f437 100644
--- a/linuxnamespaces/syscalls.py
+++ b/linuxnamespaces/syscalls.py
@@ -511,7 +511,7 @@ def mount(
target: PathConvertible,
filesystemtype: str | None,
flags: MountFlags = MountFlags.NONE,
- data: str | None = None,
+ data: str | list[str] | None = None,
) -> None:
"""Python wrapper for mount(2)."""
if (flags & MountFlags.PROPAGATION_FLAGS).bit_count() > 1:
@@ -523,6 +523,10 @@ def mount(
)
):
raise ValueError("invalid flags for mount")
+ if isinstance(data, list):
+ if any("," in s for s in data):
+ raise ValueError("data elements must not contain a comma")
+ data = ",".join(data)
call_libc(
"mount",
os.fsencode(source),