2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 22:05:27 +00:00

Fix compability with Python < 3.9

str.removeprefix() was introduced in Python 3.9. Replace it with
backwards-compatible code.
This commit is contained in:
Christian Boltz
2023-08-15 12:40:39 +02:00
parent 5f6e213d23
commit c175e414c8

View File

@@ -191,8 +191,8 @@ class ReadLog:
return
elif e['class'] and e['class'] == 'namespace':
if e['denied_mask'].startswith('userns'):
self.hashlog[aamode][full_profile]['userns'][e['denied_mask'].removeprefix('userns_')] = True
if e['denied_mask'].startswith('userns_'):
self.hashlog[aamode][full_profile]['userns'][ e['denied_mask'][7:] ] = True # [7:] removes the 'userns_' prefix
return
elif e['class'] and e['class'].endswith('mqueue'):