Skip to content

Commit

Permalink
Fix unsafe access to PATH (#756)
Browse files Browse the repository at this point in the history
* Fix unsafe access to PATH

* Fix leading separator if PATH is empty
  • Loading branch information
BowDown097 authored Aug 4, 2024
1 parent 7ac5519 commit a1ac308
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions auto_cpufreq/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
filterwarnings("ignore")

# add path to auto-cpufreq executables for GUI
os.environ["PATH"] += ":/usr/local/bin"
if "PATH" in os.environ:
os.environ["PATH"] += os.pathsep + "/usr/local/bin"
else:
os.environ["PATH"] = "/usr/local/bin"

# ToDo:
# - replace get system/CPU load from: psutil.getloadavg() | available in 5.6.2)
Expand Down Expand Up @@ -908,4 +911,4 @@ def not_running_daemon_check():
exit(1)
elif IS_INSTALLED_WITH_SNAP and dcheck == "disabled":
daemon_not_running_msg()
exit(1)
exit(1)

0 comments on commit a1ac308

Please sign in to comment.