diff options
author | 2021-12-20 14:04:10 -0800 | |
---|---|---|
committer | 2021-12-20 14:04:10 -0800 | |
commit | a8e1273bdb84f0fc521f83db72d521ed827e914d (patch) | |
tree | f899de8c3e5d4ad8c2519d2acda09e3b7cabf618 | |
parent | Add cgroupv2 initialisation (diff) |
Use the system locale's encoding for cgroup files
They're encoded with the system's locale, so that's what should be used
to read them.
-rw-r--r-- | snekbox/utils/cgroup.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/snekbox/utils/cgroup.py b/snekbox/utils/cgroup.py index 4593412..9828310 100644 --- a/snekbox/utils/cgroup.py +++ b/snekbox/utils/cgroup.py @@ -35,12 +35,12 @@ def create_dynamic(config: NsJailConfig) -> str: # instead so that children inherit it. Given the swap's dependency on the memory limit, # the memory limit must also be set on the parent. NsJail only sets the memory limit for # child cgroups, not the parent. - (mem / "memory.limit_in_bytes").write_text(mem_max, encoding="utf-8") + (mem / "memory.limit_in_bytes").write_text(mem_max) try: # Swap limit is specified as the sum of the memory and swap limits. # Therefore, setting it equal to the memory limit effectively disables swapping. - (mem / "memory.memsw.limit_in_bytes").write_text(mem_max, encoding="utf-8") + (mem / "memory.memsw.limit_in_bytes").write_text(mem_max) except PermissionError: log.warning( "Failed to set the memory swap limit for the cgroup. " |