diff options
author | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-10-17 23:20:49 -0300 |
---|---|---|
committer | Kelvin M. Klann <kmk3.code@protonmail.com> | 2022-10-18 14:54:32 -0300 |
commit | aa17ca5fc9b251cac33e8e48ac539e534c8c3c74 (patch) | |
tree | a4d0cc4e2da2e6e8f191e8400f4d9bb1536183f9 | |
parent | sort.py: rename raw_items to original_items (diff) | |
download | firejail-aa17ca5fc9b251cac33e8e48ac539e534c8c3c74.tar.gz firejail-aa17ca5fc9b251cac33e8e48ac539e534c8c3c74.tar.zst firejail-aa17ca5fc9b251cac33e8e48ac539e534c8c3c74.zip |
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
-rwxr-xr-x | contrib/sort.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/contrib/sort.py b/contrib/sort.py index 8f42e9e5c..69af99d6e 100755 --- a/contrib/sort.py +++ b/contrib/sort.py | |||
@@ -33,17 +33,17 @@ def sort_alphabetical(original_items): | |||
33 | return ",".join(items) | 33 | return ",".join(items) |
34 | 34 | ||
35 | 35 | ||
36 | def sort_protocol(protocols): | 36 | def sort_protocol(original_protocols): |
37 | """sort the given protocols into this scheme: unix,inet,inet6,netlink,packet,bluetooth""" | 37 | """sort the given protocols into this scheme: unix,inet,inet6,netlink,packet,bluetooth""" |
38 | 38 | ||
39 | # shortcut for common protocol lines | 39 | # shortcut for common protocol lines |
40 | if protocols in ("unix", "unix,inet,inet6"): | 40 | if original_protocols in ("unix", "unix,inet,inet6"): |
41 | return protocols | 41 | return original_protocols |
42 | 42 | ||
43 | fixed_protocols = "" | 43 | fixed_protocols = "" |
44 | for protocol in ("unix", "inet", "inet6", "netlink", "packet", "bluetooth"): | 44 | for protocol in ("unix", "inet", "inet6", "netlink", "packet", "bluetooth"): |
45 | for prefix in ("", "-", "+", "="): | 45 | for prefix in ("", "-", "+", "="): |
46 | if f",{prefix}{protocol}," in f",{protocols},": | 46 | if f",{prefix}{protocol}," in f",{original_protocols},": |
47 | fixed_protocols += f"{prefix}{protocol}," | 47 | fixed_protocols += f"{prefix}{protocol}," |
48 | return fixed_protocols[:-1] | 48 | return fixed_protocols[:-1] |
49 | 49 | ||