Subject: Re: c-ares not compiling with mingw32ce

Re: c-ares not compiling with mingw32ce

From: Yang Tse <yangsita_at_gmail.com>
Date: Tue, 22 Mar 2011 21:00:15 +0100

2011/3/22 Vincent Torri wrote:

> with current repo:
>
> ares_gethostbyaddr.c:222: error: 'ENOENT' undeclared (first use in this
> function)
> ares_gethostbyaddr.c:222: error: (Each undeclared identifier is reported
> only once
> ares_gethostbyaddr.c:222: error: for each function it appears in.)
> ares_gethostbyaddr.c:223: error: 'ESRCH' undeclared (first use in this
> function)
>
> I think that it's not the only place where fopen() returned value is used. I
> don't know what to do here (I don't know the code...)

Einch??? I'm certainly not a Win CE guy... In any case next two
commits seem reasonable to me...

https://github.com/bagder/c-ares/commit/c7ce7c7d4597300e7ee4079192da3c02d567223f
https://github.com/bagder/c-ares/commit/3abad87d88fc77295230ed8c732f24bfb05f4397

> Also the mode used by fopen should always be in binary mode ("rb", "wb"). On
> Unix, 'b' is ignored, but on Windows, it's important to have it:
>
> ares_gethostbyaddr.c:  fp = fopen(PATH_HOSTS, "r");
> ares_gethostbyname.c:  fp = fopen(PATH_HOSTS, "r")
> ares_init.c:    fp = fopen(PATH_RESOLV_CONF, "r");
> ares_init.c:      fp = fopen("/etc/nsswitch.conf", "r");
> ares_init.c:      fp = fopen("/etc/host.conf", "r");
> ares_init.c:      fp = fopen("/etc/svc.conf", "r");
> ares_search.c:          fp = fopen(hostaliases, "r");

All those files are actually text files. So why should we open them in
binary mode? Once you arrive to a point in which you are capable of
using c-ares on WinCE, you might want to re-address this if it is
actually needed.

More build failures?

-- 
-=[Yang]=-
Received on 2011-03-22