
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@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org