Thermald lockfile has been broken during a code cleanup, meaning multiple instances of thermald can be started. This fix is required to re-instate the lockfile functionality while also performing correct closure and removal of the lock file on thermald termination (be it an error or a successful termination). Thus this fix restores the original functionality plus it also cleans up the lockfile too.
[Test Case]
Without the fix, one can start multiple instances of thermald, e.g run the following while thermald is running as a service:
sudo thermald --no-daemon --loglevel=info
With the fix, thermald will detect another instance of thermald (via the lockfile) and terminate with an error message, for example:
Couldn't get lock file 21449
An instance of thermald is already running, exiting ...
[SRU Justification] (Vivid, Trusty)
Thermald lockfile has been broken during a code cleanup, meaning multiple instances of thermald can be started. This fix is required to re-instate the lockfile functionality while also performing correct closure and removal of the lock file on thermald termination (be it an error or a successful termination). Thus this fix restores the original functionality plus it also cleans up the lockfile too.
[Test Case]
Without the fix, one can start multiple instances of thermald, e.g run the following while thermald is running as a service:
sudo thermald --no-daemon --loglevel=info
With the fix, thermald will detect another instance of thermald (via the lockfile) and terminate with an error message, for example:
Couldn't get lock file 21449
An instance of thermald is already running, exiting ...
[Regression Potential]
Can't think of any.