[PATCH] Fix incorrect fprintf usage in log_error FRONTEND path - Mailing list pgsql-hackers

From Bryan Green
Subject [PATCH] Fix incorrect fprintf usage in log_error FRONTEND path
Date
Msg-id CAF+pBj8goe4fRmZ0V3Cs6eyWzYLvK+HvFLYEYWG=TzaM+tWPnw@mail.gmail.com
Whole thread Raw
Responses Re: [PATCH] Fix incorrect fprintf usage in log_error FRONTEND path
List pgsql-hackers
Hi,
I noticed that the log_error() utility function has a bug in its FRONTEND code path. The function uses fprintf() with a va_list argument, but fprintf() expects individual arguments. This should
be vfprintf() instead.

The relevant code:

#else
    fprintf(stderr, fmt, ap);
#endif

Should be:

#else
    vfprintf(stderr, fmt, ap);
#endif

While this code path may not currently be compiled in practice, it would cause compilation warnings or runtime crashes if the FRONTEND macro is ever defined for files containing this function.

I've attached a patch that fixes this issue.

Bryan Green
Attachment

pgsql-hackers by date:

Previous
From: jian he
Date:
Subject: Re: add function argument name to substring and substr
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Fix incorrect fprintf usage in log_error FRONTEND path