Re: Suspicious strcmp() in src/backend/parser/parse_expr.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Rikard Falkeborn <rikard(dot)falkeborn(at)gmail(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Suspicious strcmp() in src/backend/parser/parse_expr.c
Date: 2019-04-10 22:43:32
Message-ID: 1040.1554936212@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> "Rikard" == Rikard Falkeborn <rikard(dot)falkeborn(at)gmail(dot)com> writes:
> Rikard> if (strcmp(*nodename, "+") == 0 ||
> Rikard> strcmp(*nodename, "-")) // <-- notice the lack of comparisson here
> Rikard> Should the second part of the || be strcmp(*nodename, "-") == 0?

> Yes it should.

Indeed. Considering how much I hate using strcmp's result as a boolean,
you'd think I'd have got that right. Thanks for noticing!

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-04-11 02:19:46 Re: Suspicious strcmp() in src/backend/parser/parse_expr.c
Previous Message Andrew Gierth 2019-04-10 22:33:35 Re: Suspicious strcmp() in src/backend/parser/parse_expr.c