aboutsummaryrefslogtreecommitdiffstats
path: root/src/dmon.c
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2009-07-26 12:47:15 +0000
committerFrederic Culot <calcurse@culot.org>2009-07-26 12:47:15 +0000
commit3d23af73c0032ad08766d2375fd9827493a7d658 (patch)
tree695d9d0890fba0d1b4b9763289b4d20345537aa3 /src/dmon.c
parentaef6f012fe2904dcedf47b3bf9a36366841e49a2 (diff)
downloadcalcurse-3d23af73c0032ad08766d2375fd9827493a7d658.tar.gz
calcurse-3d23af73c0032ad08766d2375fd9827493a7d658.zip
More work on implementing calcurse daemon.
Diffstat (limited to 'src/dmon.c')
-rw-r--r--src/dmon.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/dmon.c b/src/dmon.c
index 9aae65f..a52d7a5 100644
--- a/src/dmon.c
+++ b/src/dmon.c
@@ -1,4 +1,4 @@
-/* $calcurse: dmon.c,v 1.2 2009/07/23 18:33:20 culot Exp $ */
+/* $calcurse: dmon.c,v 1.3 2009/07/26 12:47:15 culot Exp $ */
/*
* Calcurse - text-based organizer
@@ -61,6 +61,9 @@ dmon_sigs_hdlr (int sig)
notify_free_app ();
(void)io_fprintln (path_dmon_log, _("terminated at %s with signal %d\n"),
nowstr (), sig);
+
+ if (unlink (path_dpid) != 0)
+ EXIT (_("Could not remove daemon lock file: %s\n"), strerror (errno));
exit (EXIT_SUCCESS);
}
@@ -143,6 +146,9 @@ dmon_start (int parent_exit_status)
if (!daemonize (parent_exit_status))
EXIT (_("Cannot daemonize, aborting\n"));
+ if (!io_dump_pid (path_dpid))
+ EXIT (_("Could not set lock file\n"));
+
io_check_file (path_conf, (int *)0);
custom_load_conf (&conf, 0);