diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-08-03 14:01:12 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-08-03 14:01:12 -0400 |
commit | 6b3335aea5e5ca1ee0fdca8bbdc54c37b178bd64 (patch) | |
tree | 1d2d71c217343965cd08418968ab49f44c462dd2 /shell/shell_utils.cpp | |
parent | f35d46318b2dc91e38a3c566f89e382f6c03b2c9 (diff) | |
download | mongo-6b3335aea5e5ca1ee0fdca8bbdc54c37b178bd64.tar.gz |
test robustness
Diffstat (limited to 'shell/shell_utils.cpp')
-rw-r--r-- | shell/shell_utils.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/shell/shell_utils.cpp b/shell/shell_utils.cpp index 8a41e257b74..e968d73e63b 100644 --- a/shell/shell_utils.cpp +++ b/shell/shell_utils.cpp @@ -439,11 +439,12 @@ namespace mongo { try { // This assumes there aren't any 0's in the mongo program output. // Hope that's ok. - char buf[ 4096 ]; - char temp[ 4096 ]; + const unsigned bufSize = 8192; + char buf[ bufSize ]; + char temp[ bufSize ]; char *start = buf; while( 1 ) { - int lenToRead = 4095 - ( start - buf ); + int lenToRead = ( bufSize - 1 ) - ( start - buf ); assert( lenToRead > 0 ); int ret = read( pipe_, (void *)start, lenToRead ); if( mongo::goingAway ) @@ -467,7 +468,7 @@ namespace mongo { strcpy( temp, last ); strcpy( buf, temp ); } else { - assert( strlen( buf ) <= 4095 ); + assert( strlen( buf ) < bufSize ); } start = buf + strlen( buf ); } |