Reexecute on SIGUSR2
This commit is contained in:
@@ -463,6 +463,7 @@ void init(int argc, char *argv[])
|
|||||||
|
|
||||||
struct sigaction sa = {.sa_handler = signal_handler, .sa_flags = SA_RESTART};
|
struct sigaction sa = {.sa_handler = signal_handler, .sa_flags = SA_RESTART};
|
||||||
sigaction(SIGUSR1, &sa, 0);
|
sigaction(SIGUSR1, &sa, 0);
|
||||||
|
sigaction(SIGUSR2, &sa, 0);
|
||||||
sigaction(SIGINT, &sa, 0);
|
sigaction(SIGINT, &sa, 0);
|
||||||
sigaction(SIGTERM, &sa, 0);
|
sigaction(SIGTERM, &sa, 0);
|
||||||
sigaction(SIGHUP, &sa, 0);
|
sigaction(SIGHUP, &sa, 0);
|
||||||
@@ -2177,6 +2178,12 @@ start:
|
|||||||
// restart tint2
|
// restart tint2
|
||||||
// SIGUSR1 used when : user's signal, composite manager stop/start or xrandr
|
// SIGUSR1 used when : user's signal, composite manager stop/start or xrandr
|
||||||
goto start;
|
goto start;
|
||||||
|
} else if (signal_pending == SIGUSR2) {
|
||||||
|
fprintf(stderr, YELLOW "%s %d: reexecuting tint2..." RESET "\n", __FILE__, __LINE__);
|
||||||
|
if (execvp(argv[0], argv) == -1) {
|
||||||
|
fprintf(stderr, RED "%s %d: failed!" RESET "\n", __FILE__, __LINE__);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// SIGINT, SIGTERM, SIGHUP
|
// SIGINT, SIGTERM, SIGHUP
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user