mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-29 23:15:55 +02:00
Use sigaction() instead of deprecated function signal()
This commit is contained in:
parent
84a987e9d5
commit
d5280ebc7b
@ -139,12 +139,20 @@ const string GMenu2X::getHome(void)
|
|||||||
return gmenu2x_home;
|
return gmenu2x_home;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void set_handler(int signal, void (*handler)(int))
|
||||||
|
{
|
||||||
|
struct sigaction sig;
|
||||||
|
sigaction(signal, NULL, &sig);
|
||||||
|
sig.sa_handler = handler;
|
||||||
|
sigaction(signal, &sig, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int /*argc*/, char * /*argv*/[]) {
|
int main(int /*argc*/, char * /*argv*/[]) {
|
||||||
INFO("---- GMenu2X starting ----\n");
|
INFO("---- GMenu2X starting ----\n");
|
||||||
|
|
||||||
signal(SIGINT, &quit_all);
|
set_handler(SIGINT, &quit_all);
|
||||||
signal(SIGSEGV,&quit_all);
|
set_handler(SIGSEGV, &quit_all);
|
||||||
signal(SIGTERM,&quit_all);
|
set_handler(SIGTERM, &quit_all);
|
||||||
|
|
||||||
char *home = getenv("HOME");
|
char *home = getenv("HOME");
|
||||||
if (home == NULL) {
|
if (home == NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user