提交 04832dbc 编写于 作者: Z Zheng Shao

sst_dump: Fix incorrect cmd args parsing

Summary: The current parsing logic ignores any additional chars after the arg.

Test Plan: "./sst_dump --verify_checksumAAA" now outputs error.

Reviewers: dhruba, sheki, emayanke

Reviewed By: dhruba

CC: leveldb

Differential Revision: https://reviews.facebook.net/D7611
上级 396c3aa0
......@@ -105,12 +105,11 @@ int main(int argc, char** argv) {
{
if (strncmp(argv[i], "--file=", 7) == 0) {
dir_or_file = argv[i] + 7;
} else if (strncmp(argv[i], "--output_hex", 12) == 0) {
} else if (strcmp(argv[i], "--output_hex") == 0) {
output_hex = true;
} else if (sscanf(argv[i], "--read_num=%ld%c", &n, &junk) == 1) {
read_num = n;
} else if (strncmp(argv[i], "--verify_checksum",
strlen("--verify_checksum")) == 0) {
} else if (strcmp(argv[i], "--verify_checksum") == 0) {
verify_checksum = true;
} else if (strncmp(argv[i], "--command=", 10) == 0) {
command = argv[i] + 10;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册