mirror of
https://github.com/ceph/ceph
synced 2025-01-20 10:01:45 +00:00
Merge pull request #6797 from mathslinux/fix-parse-return
rgw: fix wrong check for parse() return Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
commit
2f9f91b6a1
@ -1494,16 +1494,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;
|
||||
|
@ -698,10 +698,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 {
|
||||
@ -723,10 +722,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 {
|
||||
|
@ -1601,10 +1601,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;
|
||||
|
Loading…
Reference in New Issue
Block a user