Remove calcurse lock file when running in interactive mode and SIGTERM is received.
This commit is contained in:
parent
3c9d6c13cc
commit
4db3b69b27
@ -1,6 +1,8 @@
|
|||||||
2009-08-09 Frederic Culot <frederic@culot.org>
|
2009-08-09 Frederic Culot <frederic@culot.org>
|
||||||
|
|
||||||
* src/notify.c (notify_thread_app): rewritten
|
* src/notify.c (notify_thread_app): rewritten
|
||||||
|
|
||||||
|
* src/sigs.c: remove calcurse lock file when SIGTERM is received
|
||||||
|
|
||||||
2009-08-02 Frederic Culot <frederic@culot.org>
|
2009-08-02 Frederic Culot <frederic@culot.org>
|
||||||
|
|
||||||
|
12
src/sigs.c
12
src/sigs.c
@ -1,4 +1,4 @@
|
|||||||
/* $calcurse: sigs.c,v 1.9 2009/07/19 16:51:36 culot Exp $ */
|
/* $calcurse: sigs.c,v 1.10 2009/08/09 15:49:58 culot Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calcurse - text-based organizer
|
* Calcurse - text-based organizer
|
||||||
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -64,6 +65,14 @@ generic_hdlr (int sig)
|
|||||||
clearok (curscr, TRUE);
|
clearok (curscr, TRUE);
|
||||||
(void)ungetch (KEY_RESIZE);
|
(void)ungetch (KEY_RESIZE);
|
||||||
break;
|
break;
|
||||||
|
case SIGTERM:
|
||||||
|
if (unlink (path_cpid) != 0)
|
||||||
|
{
|
||||||
|
EXIT (_("Could not remove calcurse lock file: %s\n"),
|
||||||
|
strerror (errno));
|
||||||
|
}
|
||||||
|
exit (EXIT_SUCCESS);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +101,7 @@ sigs_init ()
|
|||||||
{
|
{
|
||||||
if (!sigs_set_hdlr (SIGCHLD, generic_hdlr)
|
if (!sigs_set_hdlr (SIGCHLD, generic_hdlr)
|
||||||
|| !sigs_set_hdlr (SIGWINCH, generic_hdlr)
|
|| !sigs_set_hdlr (SIGWINCH, generic_hdlr)
|
||||||
|
|| !sigs_set_hdlr (SIGTERM, generic_hdlr)
|
||||||
|| !sigs_set_hdlr (SIGINT, SIG_IGN))
|
|| !sigs_set_hdlr (SIGINT, SIG_IGN))
|
||||||
exit_calcurse (1);
|
exit_calcurse (1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user