summaryrefslogtreecommitdiff
path: root/glib/gnulib
diff options
context:
space:
mode:
authorРуслан Ижбулатов <lrn1986@gmail.com>2015-04-17 16:04:31 +0000
committerРуслан Ижбулатов <lrn1986@gmail.com>2016-01-14 15:11:08 +0000
commitb7774b182dcd4cb129a4af20d624b4168d28ff90 (patch)
tree6f23bf8a7e45611bddf3cb6927e49bdf6a08244e /glib/gnulib
parent82c2461e3d719dfe11361c07502d1cf8a998c121 (diff)
downloadglib-b7774b182dcd4cb129a4af20d624b4168d28ff90.tar.gz
Make gnulib vfprintf return the number of bytes actually written
To be honest, i don't remember what problems were caused by it returning the number of bytes it *wanted* to write instead of the number of bytes it actually wrote. Probably related to the fact that fwrite could independently fail, and ignoring its return value ignores that error. https://bugzilla.gnome.org/show_bug.cgi?id=748064
Diffstat (limited to 'glib/gnulib')
-rw-r--r--glib/gnulib/printf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/glib/gnulib/printf.c b/glib/gnulib/printf.c
index 6edca1a4c..66261b8f1 100644
--- a/glib/gnulib/printf.c
+++ b/glib/gnulib/printf.c
@@ -88,16 +88,16 @@ int _g_gnulib_vprintf (char const *format, va_list args)
int _g_gnulib_vfprintf (FILE *file, char const *format, va_list args)
{
char *result;
- size_t length;
+ size_t length, rlength;
result = vasnprintf (NULL, &length, format, args);
if (result == NULL)
return -1;
- fwrite (result, 1, length, file);
+ rlength = fwrite (result, 1, length, file);
free (result);
- return length;
+ return rlength;
}
int _g_gnulib_vsprintf (char *string, char const *format, va_list args)