psql: Fix incorrect equality comparison
authorDaniel Gustafsson <dgustafsson@postgresql.org>
Thu, 27 Mar 2025 13:09:25 +0000 (14:09 +0100)
committerDaniel Gustafsson <dgustafsson@postgresql.org>
Thu, 27 Mar 2025 13:09:25 +0000 (14:09 +0100)
Commit 1a759c83278 contained an incorrect equality comparison
which was discovered by Coverity.

Reported-by: Ranier Vilela <ranier.vf@gmail.com>
Discussion: https://postgr.es/m/CAEudQApfAWzLo+oSuy2byXktdr7R8KJC_ACT5VV8fontrL35Pw@mail.gmail.com

src/bin/psql/variables.c

index 5150eb0532ba1e88e82a73ca742b42acbd13332f..ae2d0e5ed3f4720be8ea3280d1f76b0ead4eca38 100644 (file)
@@ -234,7 +234,7 @@ ParseVariableDouble(const char *value, const char *name, double *result, double
     * too close to zero to have full precision, by checking for zero or real
     * out-of-range values.
     */
-   else if ((errno = ERANGE) &&
+   else if ((errno == ERANGE) &&
             (dblval == 0.0 || dblval >= HUGE_VAL || dblval <= -HUGE_VAL))
    {
        if (name)