提交 3a81b739 编写于 作者: Z z00538436 提交者: public tcshversion

TicketNo:DTS2020090109976

Description:fix vsnprintf

Team:OTHERS
Feature or Bugfix:Bugfix
Binary Source:NA
PrivateCode(Yes/No):No

Change-Id: Ibf9200940137b8ae67e01bcc1ec1f6492a286fe3
Reviewed-on: http://mgit-tm.rnd.huawei.com/10617507Reviewed-by: Nliulei 00510663 <lewis.liulei@huawei.com>
Tested-by: Npublic jenkins <public_jenkins@notesmail.huawei.com>
Reviewed-by: Nshenwei 00579521 <denny.shenwei@huawei.com>
上级 ea1d4aec
......@@ -6,12 +6,6 @@ size_t __stdout_write(FILE *f, const unsigned char *buf, size_t len)
struct winsize wsz;
if (!(f->flags & F_SVB) && ioctl(f->fd, TIOCGWINSZ, &wsz)) {
f->lbf = EOF;
} else {
f->lbf = '\n';
f->write = __stdio_write;
f->wpos = f->wbase = f->buf;
f->wend = f->buf + f->buf_size;
}
if (len == -1) return 0;
return __stdio_write(f, buf, len);
}
......@@ -13,8 +13,6 @@ size_t __fwritex(const unsigned char *restrict s, size_t l, FILE *restrict f)
if (l > f->wend - f->wpos) return f->write(f, s, l);
if (f->lbf == EOF) f->write(f, s, -1);
if (f->lbf >= 0) {
/* Match /^(.*\n|)/ */
for (i=l; i && s[i-1] != '\n'; i--);
......
......@@ -10,6 +10,7 @@
#include <inttypes.h>
#include <math.h>
#include <float.h>
#include <sys/ioctl.h>
/* Some useful macros */
......@@ -443,7 +444,14 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
int t, pl;
wchar_t wc[2], *ws;
char mb[4];
struct winsize wsz;
if (f && (f->write == __stdout_write) && !ioctl(f->fd, TIOCGWINSZ, &wsz)) {
f->lbf = '\n';
f->write = __stdio_write;
f->wpos = f->wbase = f->buf;
f->wend = f->buf + f->buf_size;
}
for (;;) {
/* This error is only specified for snprintf, but since it's
* unspecified for other forms, do the same. Stop immediately
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册