Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw: fix wrong check for parse() return #6797

Merged
merged 2 commits into from Jan 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/osd/OSD.cc
Expand Up @@ -1504,16 +1504,16 @@ int OSD::peek_meta(ObjectStore *store, std::string& magic,
if (r < 0)
return r;
r = cluster_fsid.parse(val.c_str());
if (r < 0)
return r;
if (!r)
return -EINVAL;

r = store->read_meta("fsid", &val);
if (r < 0) {
osd_fsid = uuid_d();
} else {
r = osd_fsid.parse(val.c_str());
if (r < 0)
return r;
if (!r)
return -EINVAL;
}

return 0;
Expand Down
10 changes: 4 additions & 6 deletions src/rgw/rgw_admin.cc
Expand Up @@ -695,10 +695,9 @@ static int read_decode_json(const string& infile, T& t)
return ret;
}
JSONParser p;
ret = p.parse(bl.c_str(), bl.length());
if (ret < 0) {
if (!p.parse(bl.c_str(), bl.length())) {
cout << "failed to parse JSON" << std::endl;
return ret;
return -EINVAL;
}

try {
Expand All @@ -720,10 +719,9 @@ static int read_decode_json(const string& infile, T& t, K *k)
return ret;
}
JSONParser p;
ret = p.parse(bl.c_str(), bl.length());
if (ret < 0) {
if (!p.parse(bl.c_str(), bl.length())) {
cout << "failed to parse JSON" << std::endl;
return ret;
return -EINVAL;
}

try {
Expand Down
5 changes: 2 additions & 3 deletions src/rgw/rgw_op.cc
Expand Up @@ -1374,10 +1374,9 @@ static int forward_request_to_master(struct req_state *s, obj_version *objv, RGW
return ret;

ldout(s->cct, 20) << "response: " << response.c_str() << dendl;
ret = jp->parse(response.c_str(), response.length());
if (ret < 0) {
if (!jp->parse(response.c_str(), response.length())) {
ldout(s->cct, 0) << "failed parsing response from master region" << dendl;
return ret;
return -EINVAL;
}

return 0;
Expand Down