Rewrite sprintf_alloc.
authorgraham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 19 Nov 2010 03:55:52 +0000 (03:55 +0000)
committergraham.gower@gmail.com <graham.gower@gmail.com@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Fri, 19 Nov 2010 03:55:52 +0000 (03:55 +0000)
commit7e8e45766b6fbf8c3ea443646af259f2943e4ef2
treecfbabced3adf098d3b22cceab9c5a69b8cdd70b4
parent6ee4d7075a8d19f1b465bd2d222a182c1d8345e7
Rewrite sprintf_alloc.

The example in printf(3) that this was taken from should not be used as
it ignores negative return codes from vsnprintf, instead allocating more
memory. Given an error from vsnprintf, this would loop until the process'
virtual memory is exhausted.

So we just exit in the event of a problem instead.

git-svn-id: http://opkg.googlecode.com/svn/trunk@581 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
libopkg/sprintf_alloc.c
libopkg/sprintf_alloc.h