Re: Suspicious strcmp() in src/backend/parser/parse_expr.c - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Suspicious strcmp() in src/backend/parser/parse_expr.c
Date
Msg-id 1040.1554936212@sss.pgh.pa.us
Whole thread Raw
In response to Re: Suspicious strcmp() in src/backend/parser/parse_expr.c  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: Suspicious strcmp() in src/backend/parser/parse_expr.c  (Michael Paquier <michael@paquier.xyz>)
List pgsql-bugs
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Rikard" == Rikard Falkeborn <rikard.falkeborn@gmail.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



pgsql-bugs by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: Suspicious strcmp() in src/backend/parser/parse_expr.c
Next
From: Michael Paquier
Date:
Subject: Re: Suspicious strcmp() in src/backend/parser/parse_expr.c