From: Yan Jun Date: Fri, 27 May 2016 08:26:31 +0000 (+0800) Subject: rgw/common: fix error return value of hex_to_buf. X-Git-Tag: v11.0.0~351^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=253725ef1f200edd2eb7597de3f1dcda428b097a;p=ceph.git rgw/common: fix error return value of hex_to_buf. We should return negative value if error happens, otherwise the caller may run into exceptions. eg, rgw_swift_verify_signed_token will not return as follow: int ret = hex_to_buf(token, p.c_str(), len); if (ret < 0) return ret; Signed-off-by: Yan Jun --- diff --git a/src/rgw/rgw_common.h b/src/rgw/rgw_common.h index 3520b722815c..1e75ed284606 100644 --- a/src/rgw/rgw_common.h +++ b/src/rgw/rgw_common.h @@ -1774,7 +1774,7 @@ static inline int hex_to_buf(const char *hex, char *buf, int len) return -EINVAL; d = hexdigit(*p); if (d < 0) - return -d; + return d; buf[i] += d; i++; p++;