[Git][NTPsec/ntpsec][master] Fix for missing socket.EAI_NODATA on FreeBSD

Ian Bruene gitlab at mg.gitlab.com
Wed Sep 27 13:24:05 UTC 2017


Ian Bruene pushed to branch master at NTPsec / ntpsec


Commits:
0b517436 by Ian Bruene at 2017-09-27T08:21:17-05:00
Fix for missing socket.EAI_NODATA on FreeBSD

- - - - -


2 changed files:

- pylib/packet.py
- tests/pylib/jigs.py


Changes:

=====================================
pylib/packet.py
=====================================
--- a/pylib/packet.py
+++ b/pylib/packet.py
@@ -855,7 +855,11 @@ class ControlSession:
             except AttributeError:
                 pass
             try:
-                if e1.errno in (socket.EAI_NONAME, socket.EAI_NODATA):
+                if hasattr(socket, "EAI_NODATA"):
+                    errlist = (socket.EAI_NONAME, socket.EAI_NODATA)
+                else:
+                    errlist = (socket.EAI_NONAME,)
+                if e1.errno in errlist:
                     try:
                         return hinted_lookup(port="ntp", hints=0)
                     except socket.gaierror as e2:


=====================================
tests/pylib/jigs.py
=====================================
--- a/tests/pylib/jigs.py
+++ b/tests/pylib/jigs.py
@@ -182,7 +182,10 @@ class SocketModuleJig:
     AI_NUMERICHOST = socket.AI_NUMERICHOST
     AI_CANONNAME = socket.AI_CANONNAME
     EAI_NONAME = socket.EAI_NONAME
-    EAI_NODATA = socket.EAI_NODATA
+    if hasattr(socket, "EAI_NODATA"):
+        EAI_NODATA = socket.EAI_NODATA
+    else:  # FreeBSD is speschul
+        EAI_NODATA = None
     NI_NAMEREQD = socket.NI_NAMEREQD
 
     def __init__(self):



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0b517436c52d14836329eaed6cb0e1816d197a9e

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/0b517436c52d14836329eaed6cb0e1816d197a9e
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170927/10f3a376/attachment.html>


More information about the vc mailing list