This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: asprintf() issue
- From: Archie Cobbs <archie dot cobbs at gmail dot com>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org, Michael Kerrisk-manpages <mtk dot manpages at gmail dot com>
- Date: Wed, 13 May 2015 08:35:18 -0500
- Subject: Re: asprintf() issue
- Authentication-results: sourceware.org; auth=none
- References: <CANSoFxt-cdc-+C4u-rTENMtY4X9RpRSuv+axDswSPxbDgag8_Q at mail dot gmail dot com> <55520F8F dot 9020308 at redhat dot com> <CANSoFxvac6_uBgwzWm5q6U+GcWzzKtDtDP0BVvE4eL08zXHs5Q at mail dot gmail dot com> <5552183C dot 2070809 at redhat dot com>
On Tue, May 12, 2015 at 10:11 AM, Florian Weimer <fweimer@redhat.com> wrote:
> To me, this implies the original value is preserved. We can add this to
> the documentation if that makes everyone happy.
Here's a proposed patch:
manual/stdio.texi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/manual/stdio.texi b/manual/stdio.texi
index e407170..bf7cffe 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -2551,6 +2551,8 @@ The return value is the number of characters
allocated for the buffer, or
less than zero if an error occurred. Usually this means that the buffer
could not be allocated.
+If an error occurs, the contents of *@var{ptr} are not modified.
+
Here is how to use @code{asprintf} to get the same result as the
@code{snprintf} example, but more easily:
Thanks,
-Archie
--
Archie L. Cobbs