ref: 56664b608a19917f33b0c35f3191cbb538da0cce
parent: e6923c7d29ffd282fc5ee3b2494d94bbd627c3ac
author: mischief <mischief@offblast.org>
date: Wed Nov 6 06:22:15 EST 2013
synchronize ape's vfprintf with libstdio in ape's vfprintf we don't check if the file we're writing is actually a string buffer, resulting in a return of -1, when we should actually return the number of bytes that would be written.
--- a/sys/src/ape/lib/ap/stdio/vfprintf.c
+++ b/sys/src/ape/lib/ap/stdio/vfprintf.c
@@ -202,7 +202,15 @@
nprint++;
}
}
- return ferror(f)? -1: nprint;;
+
+ if(ferror(f)){+ if((f->flags&STRING) && f->wp==f->rp && f->wp>f->buf){+ *(f->wp-1) = '\0';
+ return nprint;
+ }
+ return -1;
+ }
+ return nprint;
}
static int
--
⑨