qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 4/5] Avoid unportable %m format


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 4/5] Avoid unportable %m format
Date: Tue, 10 Jul 2012 16:23:56 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

On 07/10/2012 04:12 PM, Stefan Weil wrote:
Am 10.07.2012 22:53, schrieb Anthony Liguori:
On 07/08/2012 06:51 AM, address@hidden wrote:
From: Blue Swirl<address@hidden>

Replace %m format with explicit call to standard strerror().

Signed-off-by: Blue Swirl<address@hidden>

I would expect '%m' to be thread safe whereas strerror() isn't. I don't think
this change is actually good.

You'd need to do something more clever with strerror_r() to be equivalent.

Regards,

Anthony Liguori


Extract from the Linux manpage PRINTF(3):

m (Glibc extension.) Print output of strerror(errno). No argument is required.

You're reading the docs too literally:

http://sourceware.org/git/?p=glibc.git;a=blob;f=stdio-common/vfprintf.c;h=d5690342536bc8cf948c786f663bb63f73f91f3a;hb=HEAD#l966

It uses strerror_r() and is thread-safe. Converting to strerror() removes that safety.

Regards,

Anthony Liguori



reply via email to

[Prev in Thread] Current Thread [Next in Thread]