Fix closing oscam in *BSD
|Reported by:||leecher2||Owned by:|
|Severity:||medium||Keywords:||openbsd, freebsd, exit, close, ctrl-c, shutdown|
At least on OpenBSD 5.9,6.0-curent and FreeBSD 10.3-RELEASE, oscam won't exit properly. You must send a kill -9 to terminate the process.
This is due cs_exit() code hitting (!cl) condition. Apparently on OpenBSD and FreeBSD, cur_client() isn't populated at that point, and causes oscam to not terminate under any proper condition. Seems to be a libpthread behavior/issue/feature.
Attached patch fixes for me, and makes the following exit triggers to work again:
-Ctrl-C in terminal when process is in FG (SIGINT)
-Normal "kill" (SIGTERM)
-start/stop rc.d script (apparently does SIGTERM too).
Please take this ticket as a request for comments, as I'm not involved in oscam code and don't know if bypassing (!cl) code may trigger anything worse than this bug itself. Also, this code is untested on Linux.
When the issue occurs
Trying to exit oscam on OpenBSD and FreeBSD