summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-03-06 19:47:46 +0000
committerpjd <pjd@FreeBSD.org>2011-03-06 19:47:46 +0000
commitafeb46924f240d98faa8d6db6392cea23842af0a (patch)
tree13c695a6514c3ee36d34f966c45045c8b283fc34 /lib
parent8bca3d08d56e2218c653bd733b5e20278339eead (diff)
downloadFreeBSD-src-afeb46924f240d98faa8d6db6392cea23842af0a.zip
FreeBSD-src-afeb46924f240d98faa8d6db6392cea23842af0a.tar.gz
Because we call __printf_out() with a on-stack buffer, also call
__printf_flush() so we are sure it won't be referenced after we return. MFC after: 2 weeks
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/xprintf_time.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/stdio/xprintf_time.c b/lib/libc/stdio/xprintf_time.c
index c80681e..debfac5 100644
--- a/lib/libc/stdio/xprintf_time.c
+++ b/lib/libc/stdio/xprintf_time.c
@@ -62,7 +62,7 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const
struct timespec *ts;
time_t *tp;
intmax_t t, tx;
- int i, prec, nsec;
+ int i, prec, nsec, ret;
if (pi->is_long) {
tv = *((struct timeval **)arg[0]);
@@ -116,5 +116,7 @@ __printf_render_time(struct __printf_io *io, const struct printf_info *pi, const
nsec /= 10;
p += sprintf(p, ".%.*d", prec, nsec);
}
- return(__printf_out(io, pi, buf, p - buf));
+ ret = __printf_out(io, pi, buf, p - buf);
+ __printf_flush(io);
+ return (ret);
}
OpenPOWER on IntegriCloud