mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
sort.py: rename protocols to original_protocols
To make it clearer. There are 3 different instances of protocol-related objects being used in the fix_protocol function: * The input * The array of common sorted lines * The (sorted) output
This commit is contained in:
parent
2a7cc2e7ad
commit
aa17ca5fc9
1 changed files with 4 additions and 4 deletions
|
|
@ -33,17 +33,17 @@ def sort_alphabetical(original_items):
|
|||
return ",".join(items)
|
||||
|
||||
|
||||
def sort_protocol(protocols):
|
||||
def sort_protocol(original_protocols):
|
||||
"""sort the given protocols into this scheme: unix,inet,inet6,netlink,packet,bluetooth"""
|
||||
|
||||
# shortcut for common protocol lines
|
||||
if protocols in ("unix", "unix,inet,inet6"):
|
||||
return protocols
|
||||
if original_protocols in ("unix", "unix,inet,inet6"):
|
||||
return original_protocols
|
||||
|
||||
fixed_protocols = ""
|
||||
for protocol in ("unix", "inet", "inet6", "netlink", "packet", "bluetooth"):
|
||||
for prefix in ("", "-", "+", "="):
|
||||
if f",{prefix}{protocol}," in f",{protocols},":
|
||||
if f",{prefix}{protocol}," in f",{original_protocols},":
|
||||
fixed_protocols += f"{prefix}{protocol},"
|
||||
return fixed_protocols[:-1]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue