[libvirt] [PATCH 13/15] util: Replace pciWaitForDeviceCleanup with a stub on Windows

Eric Blake eblake at redhat.com
Mon Mar 22 16:54:09 UTC 2010

On 03/22/2010 09:03 AM, Daniel P. Berrange wrote:
> On Mon, Mar 22, 2010 at 02:25:43AM +0100, Matthias Bolte wrote:
>> sscanf doesn't support the L modifier on Windows and gnulib has no
>> replacement for the scanf functions. Just replace the function with
>> a stub on Windows, because it's not used on the libvirt client side.
>> ---
>>  src/util/pci.c |   14 ++++++++++++++
>>  1 files changed, 14 insertions(+), 0 deletions(-)
> We already had this problem with printf(). For that gnulib provided
> us with a replacement that worked. We should probably pull in the
> scanf module from gnulib for equivalent compatability. Even though
> this code isn't technically required, other places may start using
> scanf & trip up on this problem

But that's the point that Matthias made - currently, gnulib does NOT
provide a scanf module.  Why?  Because scanf comes with its own set of
usability pitfalls (scanf("%d",&int) cannot report whether integer
overflow occurred), so no one has made it a high enough priority to
start replacing the portability pitfalls.

I've already mentioned that it would be a better cleanup to stop using
*scanf altogether; but that would be an independent cleanup, unrelated
to this particular patch.

For this particular patch, mingw also lacks /proc/iomem, so the fopen
earlier in pciWaitForDeviceCleanup should have already failed before we
ever get to the problematic sscanf("%Lx").  Therefore, do we even need
this patch?

Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 323 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100322/db9e6280/attachment-0001.sig>

More information about the libvir-list mailing list