summaryrefslogtreecommitdiff
path: root/linuxnamespaces
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2024-05-17 10:51:22 +0200
committerHelmut Grohne <helmut@subdivi.de>2024-05-17 10:51:22 +0200
commitad413c3165bfe6c5296133473c2aa9c626704f75 (patch)
treeba4a6c7f1e995051a7d2435889821b234d592e82 /linuxnamespaces
parent9fea618481256122c1bd2a62ec382623b7528865 (diff)
downloadpython-linuxnamespaces-ad413c3165bfe6c5296133473c2aa9c626704f75.tar.gz
populate_dev: also create std{in,out,err} symlinks
When booting systemd, it'll create these symlinks, but when doing an application container, nothing does this and we risk creating regular files there.
Diffstat (limited to 'linuxnamespaces')
-rw-r--r--linuxnamespaces/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py
index e305b4e..54a6883 100644
--- a/linuxnamespaces/__init__.py
+++ b/linuxnamespaces/__init__.py
@@ -368,7 +368,11 @@ def populate_dev(
newdev = AtLocation(newroot) / "dev"
directories = {"pts"}
files = set()
- symlinks = {}
+ symlinks = {
+ "stdin": "/proc/self/fd/0",
+ "stdout": "/proc/self/fd/1",
+ "stderr": "/proc/self/fd/2",
+ }
bind_mounts: dict[str, AtLocation] = {}
with contextlib.ExitStack() as exitstack:
for fn in "null zero full random urandom tty".split():