Fixing fprintf of non string literal

Summary:
sst_dump_tool contains two instances of `fprintf`s where the `format` argument is not
a string literal. This prevents the code from compiling with some compilers/compiler
options because of the potential security risks associated with printing non-literals.

Test Plan: make all

Reviewers: rven, igor, yhchiang, sdong, anthony

Reviewed By: anthony

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D43305
This commit is contained in:
Andres Noetzli 2015-07-30 17:46:47 -07:00
parent 193dc977e7
commit 544be638ab

View file

@ -126,14 +126,14 @@ uint64_t SstFileReader::CalculateCompressedTableSize(
unique_ptr<Iterator> iter(table_reader_->NewIterator(ReadOptions())); unique_ptr<Iterator> iter(table_reader_->NewIterator(ReadOptions()));
for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
if (!iter->status().ok()) { if (!iter->status().ok()) {
fprintf(stderr, iter->status().ToString().c_str()); fputs(iter->status().ToString().c_str(), stderr);
exit(1); exit(1);
} }
table_builder_->Add(iter->key(), iter->value()); table_builder_->Add(iter->key(), iter->value());
} }
Status s = table_builder_->Finish(); Status s = table_builder_->Finish();
if (!s.ok()) { if (!s.ok()) {
fprintf(stderr, s.ToString().c_str()); fputs(s.ToString().c_str(), stderr);
exit(1); exit(1);
} }
uint64_t size = table_builder_->FileSize(); uint64_t size = table_builder_->FileSize();