Re: [libvirt] [PATCH] fix MinGW compilation(200808)

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

 



Jim Meyering <jim@xxxxxxxxxxxx> wrote:

> "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
>> On Tue, Aug 05, 2008 at 01:52:58PM +0200, Jim Meyering wrote:
>>> Atsushi SAKAI <sakaia@xxxxxxxxxxxxxx> wrote:
>>> ...
>>> > network_conf.c:290: warning: implicit declaration of function `inet_aton'
>>> > network_conf.c:290: warning: nested extern declaration of `inet_aton'
>>>
>>> We can/should use inet_pton instead.  Then, not only do we use what seems
>>> to be the preferred interface, but there is a gnulib module by the same
>>> name that can come into play if it too is missing.
>>
>> Even better would be to use  getaddrinfo() with AI_NUMERIC, since we
>> already require getaddrinfo() to work on Windows for the remote driver
>
> Dan,
>
> If you don't object, I'll go for the simpler interface (and smaller
> change).  However I've just noticed that that will require an adjustment
> of the gnulib license for the inet_pton module.  But that shouldn't be
> a problem, since the code in question is glibc-derived.
>
> Here's the required patch, excluding the bit that will
> add the new file(s) from gnulib, once the license has
> been adjusted.
...
> -        if (!inet_aton(def->netmask, &innetmask)) {
> +        if (!inet_pton(AF_INET, def->netmask, &innetmask) <= 0) {

Whoops.  I forgot to remove one of the "!".
Here's the correct patch:

diff --git a/bootstrap b/bootstrap
index bc1c352..70b9a05 100755
--- a/bootstrap
+++ b/bootstrap
@@ -69,6 +69,7 @@ c-ctype
 getaddrinfo
 getpass
 gettext
+inet_pton
 mktempd
 physmem
 poll
diff --git a/src/network_conf.c b/src/network_conf.c
index 10c9dca..f70c73d 100644
--- a/src/network_conf.c
+++ b/src/network_conf.c
@@ -286,13 +286,13 @@ virNetworkDefParseXML(virConnectPtr conn,
         char *netaddr;
         xmlNodePtr dhcp;

-        if (!inet_aton(def->ipAddress, &inaddress)) {
+        if (inet_pton(AF_INET, def->ipAddress, &inaddress) <= 0) {
             virNetworkReportError(conn, VIR_ERR_INTERNAL_ERROR,
                                   _("cannot parse IP address '%s'"),
                                   def->ipAddress);
             goto error;
         }
-        if (!inet_aton(def->netmask, &innetmask)) {
+        if (inet_pton(AF_INET, def->netmask, &innetmask) <= 0) {
             virNetworkReportError(conn, VIR_ERR_INTERNAL_ERROR,
                                   _("cannot parse netmask '%s'"),
                                   def->netmask);

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]