[pacman-dev] Dealing with asprintf failures

Andres P aepd87 at gmail.com
Sun Jun 27 20:24:47 EDT 2010


On Sun, Jun 27, 2010 at 6:45 PM, Allan McRae <allan at archlinux.org> wrote:
> On 28/06/10 06:31, Andres P wrote:
>>
>> On Sun, Jun 27, 2010 at 9:22 AM, Allan McRae<allan at archlinux.org>  wrote:
>>>
>>> So, any ideas on the best way to approach this?
>>
>> Counting 13 instances of asprintf, so voting "no" to both suggestions so
>> far.
>
> What does the number of asprintf's have to do with this?

I hope you don't suggest changing each to if(!asprintf(...))

>
> Anyway, voting no does not count if you do not provide a better solution.
>  The return value of asprintf needs to be checked when compiling with
> -D_FORTIFY_SOURCE=2 which I want to use with --enable-debug.  So something
> has to be done...

You already have a pm_vasprintf wrapper, so I don't see why you couldn't make a
asprintf wrapper here.

Both of these solutions, the original proposition and writing a wrapper, are
ultimately workarounds since the parent functions need to be changed from void
so that nobody is reduced to a little shy message log instead of an exit.

Why would you change this just to compile with fortify_source when it's showing
inherent problems that are more important?


btw, http://www.ijs.si/software/snprintf/

Andres P


More information about the pacman-dev mailing list