]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/common: fix error return value of hex_to_buf. 9367/head
authorYan Jun <yan.jun8@zte.com.cn>
Fri, 27 May 2016 08:26:31 +0000 (16:26 +0800)
committerYan Jun <yan.jun8@zte.com.cn>
Fri, 27 May 2016 08:26:31 +0000 (16:26 +0800)
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 <yan.jun8@zte.com.cn>
src/rgw/rgw_common.h

index 3520b722815cb13110937712af62d0bd255a7774..1e75ed2846062f8e92bc31599d1e0a2e2b031292 100644 (file)
@@ -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++;