Subject: Re: adig.c calls perror()

Re: adig.c calls perror()

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Tue, 21 Aug 2012 17:55:34 +0200

"Daniel Stenberg" <daniel_at_haxx.se> wrote:

>> We could probably just drop perror() in adig.c. And just print the error
>> number from SOCKERRNO.
>
> I quite agree. Care to provide a patch?

Okay:

diff -u3 -Hb -r Git-latest\adig.c .\adig.c
--- Git-latest\adig.c Wed Oct 12 11:43:30 2011
+++ .\adig.c Tue Aug 21 17:51:13 2012
@@ -390,9 +390,9 @@
         break;
       tvp = ares_timeout(channel, NULL, &tv);
       count = select(nfds, &read_fds, &write_fds, NULL, tvp);
- if (count < 0 && SOCKERRNO != EINVAL)
+ if (count < 0 && (status = SOCKERRNO) != EINVAL)
         {
- perror("select");
+ printf("select fail: %d", status);
           return 1;
         }
       ares_process(channel, &read_fds, &write_fds);

--gv
Received on 2012-08-21