From: Sage Weil Date: Mon, 13 Sep 2010 03:26:57 +0000 (-0700) Subject: osd: fix osdcaps parsing negative return value X-Git-Tag: v0.21.3~12 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3695de1e6ecb957f3c3319b867e486c84a834e25;p=ceph.git osd: fix osdcaps parsing negative return value --- diff --git a/src/osd/OSDCaps.cc b/src/osd/OSDCaps.cc index 5e219d9aabdbe..6a6a61901925b 100644 --- a/src/osd/OSDCaps.cc +++ b/src/osd/OSDCaps.cc @@ -40,16 +40,16 @@ bool OSDCaps::get_next_token(string s, size_t& pos, string& token) int start = s.find_first_not_of(" \t", pos); int end; + if (start < 0) { + return false; + } + if (s[start] == '=' || s[start] == ',' || s[start] == ';') { end = start + 1; } else { end = s.find_first_of(";,= \t", start+1); } - if (start < 0) { - return false; - } - if (end < 0) { end=s.size(); }