Skip to content

Commit

Permalink
Adding root_check before set_override method execution (#524)
Browse files Browse the repository at this point in the history
This will ensure that set_override calls are always in su mode.
So, in effect all override using 'force' can clearly access
the governer_override_state path file, and write changes to it,
without externally tinkering the environment.
  • Loading branch information
rootCircle committed Jun 24, 2023
1 parent d593e3e commit 486a9a6
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions auto_cpufreq/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def get_override():
return "default"

def set_override(override):
root_check() # Calling root_check inside if and elif might be too verbose and is susceptible to bugs in future
if override in ["powersave", "performance"]:
with open(governor_override_state, "wb") as store:
pickle.dump(override, store)
Expand Down

0 comments on commit 486a9a6

Please sign in to comment.