mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
Re-enable signal handlers once the custom sighandler has been hit to make it possible to still kill cgminer.
This commit is contained in:
parent
f762da01eb
commit
18af4e6272
9
main.c
9
main.c
@ -186,6 +186,8 @@ static char longpoll_block[37];
|
||||
static char blank[37];
|
||||
static char datestamp[40];
|
||||
|
||||
struct sigaction termhandler, inthandler;
|
||||
|
||||
static void applog_and_exit(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
@ -810,6 +812,9 @@ void kill_work(void)
|
||||
|
||||
static void sighandler(int sig)
|
||||
{
|
||||
/* Restore signal handlers so we can still quit if kill_work fails */
|
||||
sigaction(SIGTERM, &termhandler, NULL);
|
||||
sigaction(SIGINT, &inthandler, NULL);
|
||||
kill_work();
|
||||
}
|
||||
|
||||
@ -2099,8 +2104,8 @@ int main (int argc, char *argv[])
|
||||
return 1;
|
||||
|
||||
handler.sa_handler = &sighandler;
|
||||
sigaction(SIGTERM, &handler, 0);
|
||||
sigaction(SIGINT, &handler, 0);
|
||||
sigaction(SIGTERM, &handler, &termhandler);
|
||||
sigaction(SIGINT, &handler, &inthandler);
|
||||
|
||||
gettimeofday(&total_tv_start, NULL);
|
||||
gettimeofday(&total_tv_end, NULL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user