From 00ca5d90fe11b3e3fa6c3651542113736adddcf1 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Sat, 27 Feb 2010 23:05:40 -0500 Subject: fix for csv import where last field has " SERVER-682 --- tools/import.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/import.cpp b/tools/import.cpp index 846104dcce1..a26dd392873 100644 --- a/tools/import.cpp +++ b/tools/import.cpp @@ -201,7 +201,7 @@ public: log(1) << "filesize: " << fileSize << endl; ProgressMeter pm( fileSize ); const int BUF_SIZE = 1024 * 1024 * 4; - boost::scoped_array line(new char[BUF_SIZE]); + boost::scoped_array line(new char[BUF_SIZE+2]); while ( *in ){ char * buf = line.get(); in->getline( buf , BUF_SIZE ); @@ -214,6 +214,8 @@ public: if ( ! len ) continue; + buf[len+1] = 0; + if ( in->rdstate() == ios_base::eofbit ) break; assert( in->rdstate() == 0 ); -- cgit v1.2.1