From 5d82b8652f9618f97c27754619d689d1726da617 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Thu, 28 Apr 2011 14:28:54 +0200 Subject: [PATCH] improve acknowledgement of interrupt requests while starting monitor --- src/index/recollindex.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index/recollindex.cpp b/src/index/recollindex.cpp index 830bbffb..0beb6cf1 100644 --- a/src/index/recollindex.cpp +++ b/src/index/recollindex.cpp @@ -326,7 +326,11 @@ int main(int argc, const char **argv) lockorexit(&pidfile); if (!(op_flags&OPT_D)) { LOGDEB(("recollindex: daemonizing\n")); - daemon(0,0); + if (daemon(0,0) != 0) { + fprintf(stderr, "daemon() failed, errno %d\n", errno); + LOGERR(("daemon() failed, errno %d\n", errno)); + exit(1); + } } // Not too sure if I have to redo the nice thing after daemon(), // can't hurt anyway (easier than testing on all platforms...) @@ -343,7 +347,10 @@ int main(int argc, const char **argv) exit(0); confindexer = new ConfIndexer(config, &updater); - confindexer->index(rezero, ConfIndexer::IxTAll); + if (!confindexer->index(rezero, ConfIndexer::IxTAll) || stopindexing) { + LOGERR(("recollindex, initial indexing pass failed, not going into monitor mode\n")); + exit(1); + } deleteZ(confindexer); int opts = RCLMON_NONE; if (op_flags & OPT_D)