wmix: create the PID file only after successful initialisation
commite2dc01bdc03f43c8ec09e2262a911bde05af70f9
authorChristophe CURIS <christophe.curis@free.fr>
Sat, 7 Jun 2014 19:21:44 +0000 (7 21:21 +0200)
committerCarlos R. Mafra <crmafra@gmail.com>
Sat, 7 Jun 2014 20:27:27 +0000 (7 21:27 +0100)
treee2f840a31de28faf6b5baaeef90695b642edebf5
parent8eae1880b9bb5b4b109490d824d2d79e38af60bd
wmix: create the PID file only after successful initialisation

The PID file was created at the early beginning, but wmix can abort later
if something is not ok. It is better to create it at the end, so it will
be created only if wmix will actually be running.

Took the opportunity to move the code to a dedicated function to keep main
simple, and added a check to fix possible crash on startup if environment
variable $HOME does not exist.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
wmix/include/misc.h
wmix/misc.c
wmix/wmix.c