From: Colin Patrick McCabe Date: Thu, 28 Oct 2010 22:26:05 +0000 (-0700) Subject: cephtool: only initialize the tokenizer once X-Git-Tag: v0.23~79 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=89273b7fe05f54a787d69e8b4b052a2fac1b34f9;p=ceph.git cephtool: only initialize the tokenizer once Only initialize the tokenizer once. It gets cranky if it we call tok_init more than once. Signed-off-by: Colin McCabe --- diff --git a/src/tools/ceph.cc b/src/tools/ceph.cc index d0cc82d0654f..627dcbf80d09 100644 --- a/src/tools/ceph.cc +++ b/src/tools/ceph.cc @@ -56,6 +56,7 @@ struct ceph_tool_data g; static Cond cmd_cond; static SimpleMessenger *messenger = 0; static SafeTimer timer(g.lock); +static Tokenizer *tok; static const char *outfile = 0; @@ -449,10 +450,8 @@ int run_command(const char *line) int argc; const char **argv; - Tokenizer *tok = tok_init(NULL); tok_str(tok, line, &argc, &argv); tok_reset(tok); - tok_end(tok); vector cmd; const char *infile = 0; @@ -595,6 +594,9 @@ int main(int argc, const char **argv) if (g.mc.build_initial_monmap() < 0) return -1; + // initialize tokenizer + tok = tok_init(NULL); + // start up network messenger = new SimpleMessenger(); messenger->register_entity(entity_name_t::CLIENT()); @@ -680,5 +682,6 @@ int main(int argc, const char **argv) // wait for messenger to finish messenger->wait(); messenger->destroy(); + tok_end(tok); return ret; }