From: Eric Sunshine Date: Thu, 09 Jun 2016 21:39:15 GMT Subject: Re: [PATCH 1/2] bisect--helper: `is_expected_rev` shell function in C Message-ID: In-Reply-To: On Thu, Jun 9, 2016 at 5:33 PM, Eric Sunshine wrote: > On Wed, Jun 8, 2016 at 11:24 AM, Pranit Bauva wrote: >> + strbuf_trim(&actual_hex); >> + return !strcmp(actual_hex.buf, expected_hex); > > Thus, it only ever gets to this point if the file exists but is empty, > which is very unlikely to match 'expected_hex'. I could understand it > if you checked the result of strbuf_read_file() with <0 or even <=0, > but the current code doesn't make sense to me. By the way, this is also leaking strbuf 'actual_hex'.