Re: Reasons not to like asprintf

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Reasons not to like asprintf
Дата
Msg-id 5326.1382474182@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Reasons not to like asprintf  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Tom Lane wrote:
>> ... BTW, another reason to choose identical APIs for frontend and backend
>> versions of these functions is that it greatly eases use of them in shared
>> frontend/backend code.  As I notice somebody has *already done* in
>> common/relpath.c.   I'm not exactly sure how those psprintf calls are
>> working at all in frontend builds.

> There's psprintf in src/common/fe_memutils.c, too, using the backend's
> API, which is why this works.

Ah --- that's why it links, anyway.  As for "works", I suspect that the
answer is that anole has a vsnprintf that returns -1 on buffer overrun.
vasprintf and then psprintf will interpret that as "out of memory",
resulting in the observed behavior.  It'd be interesting to see the stack
trace from that error, though, just to confirm this theory.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Failure while inserting parent tuple to B-tree is not fun
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Failure while inserting parent tuple to B-tree is not fun