Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 6 May 2023 05:53:40 +0200
From: Markus Wichmann <nullplan@....net>
To: musl@...ts.openwall.com
Subject: Re: Question: Why vfprintf call twice printf_core?

Am Sat, May 06, 2023 at 11:29:36AM +0800 schrieb 847567161:
> Hello,
>     I'm analyzing vfprintf performance, I don't know why musl call
>     "printf_core(0, fmt, &amp;ap2, nl_arg, nl_type)" here. Could you
>     tell me the reason?
>     https://gitee.com/openharmony/third_party_musl/blob/master/src/stdio/vfprintf.c#L668
>     More info:    I use gdb to debug vfprintf , I found it return
>     directly when calling printf_core firstly which file parameter is
>     0.
>     https://gitee.com/openharmony/third_party_musl/blob/master/src/stdio/vfprintf.c#L526
>     Best Regards Chuang Yin

First call to printf_core() checks to see if there are any major
problems with the format string, and if the string is using positional
arguments (e.g. "%2$d"), also establishes the types of these arguments
and writes them into an array. Second call does the actual work.

The shortcut after the first printf_core() call is an error exit. That
means the format string is invalid. Could you tell us what the format
string is in your case?

Additionally, there is something weird with your mail client; it is
writing HTML entities into the plain text.

Ciao,
Markus

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.