From dd74bdb48560800cfffa7c48cacc2c42a912588b Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Tue, 5 Feb 2008 00:58:09 +0000 Subject: Fix a crash during shut down (typo in thread initialisation). --- ncpd/main.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ncpd') diff --git a/ncpd/main.cc b/ncpd/main.cc index 3c70a50..851ea9f 100644 --- a/ncpd/main.cc +++ b/ncpd/main.cc @@ -135,7 +135,7 @@ pollSocketConnections(void *) numScp--; for (int j = i; j < numScp; j++) scp[j] = scp[j + 1]; - i--; + i--; } } } @@ -383,7 +383,7 @@ main(int argc, char **argv) lerr << "Could not create Link thread" << endl; exit(-1); } - if (pthread_create(&thr_a, NULL, + if (pthread_create(&thr_b, NULL, pollSocketConnections, NULL) != 0) { lerr << "Could not create Socket thread" << endl; exit(-1); @@ -393,10 +393,14 @@ main(int argc, char **argv) linf << _("terminating") << endl; void *ret; pthread_join(thr_a, &ret); + linf << _("joined Link thread") << endl; pthread_join(thr_b, &ret); + linf << _("joined Socket thread") << endl; delete theNCP; + linf << _("shut down NCP") << endl; } skt.closeSocket(); + linf << _("socket closed") << endl; break; case -1: lerr << "fork: " << strerror(errno) << endl; @@ -404,6 +408,8 @@ main(int argc, char **argv) default: exit(0); } + linf << _("normal exit") << endl; + return 0; } /* -- cgit v1.2.3