summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/dump.cpp2
-rw-r--r--tools/tool.cpp12
2 files changed, 8 insertions, 6 deletions
diff --git a/tools/dump.cpp b/tools/dump.cpp
index c99aaaa..155f84b 100644
--- a/tools/dump.cpp
+++ b/tools/dump.cpp
@@ -293,6 +293,8 @@ public:
}
}
+ auth("local");
+
BSONObj op = conn(true).findOne(opLogName, Query().sort("$natural", -1), 0, QueryOption_SlaveOk);
if (op.isEmpty()) {
cout << "No operations in oplog. Please ensure you are connecting to a master." << endl;
diff --git a/tools/tool.cpp b/tools/tool.cpp
index f687269..54dc5df 100644
--- a/tools/tool.cpp
+++ b/tools/tool.cpp
@@ -400,14 +400,14 @@ namespace mongo {
ProgressMeter m( fileLength );
while ( read < fileLength ) {
- int readlen = fread(buf, 4, 1, file);
+ size_t amt = fread(buf, 1, 4, file);
+ assert( amt == 4 );
+
int size = ((int*)buf)[0];
- if ( size >= BUF_SIZE ) {
- cerr << "got an object of size: " << size << " terminating..." << endl;
- }
- uassert( 10264 , "invalid object size" , size < BUF_SIZE );
+ uassert( 10264 , str::stream() << "invalid object size: " << size , size < BUF_SIZE );
- readlen = fread(buf+4, size-4, 1, file);
+ amt = fread(buf+4, 1, size-4, file);
+ assert( amt == (size_t)( size - 4 ) );
BSONObj o( buf );
if ( _objcheck && ! o.valid() ) {