Create pidfile after espeakup is really ready. --- espeakup-0.71.orig/espeakup.c +++ espeakup-0.71/espeakup.c @@ -118,12 +118,6 @@ if (!debug) { /* become a daemon */ daemon(0, 1); - - /* write our pid file. */ - if (create_pid_file() < 0) { - perror("Unable to create pid file"); - return 2; - } } /* initialize espeak */ @@ -147,6 +141,14 @@ return 4; } + if (!debug) { + /* We are now ready, write our pid file. */ + if (create_pid_file() < 0) { + perror("Unable to create pid file"); + return 2; + } + } + /* run the main loop */ main_loop(&s);