[Top][All Lists]

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

[gpsd-dev] [PATCH v2 1/1] gps2udp: reset errno after getaddrinfo call

From: Ferry Huberts
Subject: [gpsd-dev] [PATCH v2 1/1] gps2udp: reset errno after getaddrinfo call
Date: Fri, 3 Jan 2014 11:10:57 +0100

From: Ferry Huberts <address@hidden>

It returns errno==2 ("No such file or directory") when the program
is run as "LD_LIBRARY_PATH=. ./gps2udp -n -u"
in the source directory.

The observed effect was that the port number conversion considered
a perfectly valid port number as invalid.

Signed-off-by: Ferry Huberts <address@hidden>

Found some time to look into this...

 netlib.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/netlib.c b/netlib.c
index 3692144..3539b45 100644
--- a/netlib.c
+++ b/netlib.c
@@ -18,6 +18,7 @@
 #include <arpa/inet.h>     /* for htons() and friends */
 #include <unistd.h>
 #endif /* S_SPLINT_S */
+#include "errno.h"
 #include "gpsd.h"
 #include "sockaddr.h"
@@ -58,6 +59,7 @@ socket_t netlib_connectsock(int af, const char *host, const 
char *service,
     if ((ret = getaddrinfo(host, service, &hints, &result))) {
        return NL_NOHOST;
+    errno=0;
 #endif /* S_SPLINT_S */

reply via email to

[Prev in Thread] Current Thread [Next in Thread]