mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Make mongoimport work w/o final EOL. SERVER-1152
This commit is contained in:
parent
1f2c2e8cb6
commit
4cd8bf8291
@ -224,10 +224,12 @@ public:
|
||||
ProgressMeter pm( fileSize );
|
||||
const int BUF_SIZE = 1024 * 1024 * 4;
|
||||
boost::scoped_array<char> line(new char[BUF_SIZE+2]);
|
||||
while ( *in ){
|
||||
while ( in->rdstate() == 0 ){
|
||||
char * buf = line.get();
|
||||
in->getline( buf , BUF_SIZE );
|
||||
uassert( 10263 , "unknown error reading file" , ( in->rdstate() & ios_base::badbit ) == 0 );
|
||||
uassert( 10263 , "unknown error reading file" ,
|
||||
(!(in->rdstate() & ios_base::badbit)) &&
|
||||
(!(in->rdstate() & ios_base::failbit) || (in->rdstate() & ios_base::eofbit)) );
|
||||
log(1) << "got line:" << buf << endl;
|
||||
|
||||
while( isspace( buf[0] ) ) buf++;
|
||||
@ -238,10 +240,6 @@ public:
|
||||
|
||||
buf[len+1] = 0;
|
||||
|
||||
if ( in->rdstate() == ios_base::eofbit )
|
||||
break;
|
||||
assert( in->rdstate() == 0 );
|
||||
|
||||
try {
|
||||
BSONObj o = parseLine( buf );
|
||||
if ( _headerLine ){
|
||||
|
Loading…
Reference in New Issue
Block a user