[Git][NTPsec/ntpsec][master] Address Gitlab issue #136: Peers without rDNS are blank in pyntpq -p
Eric S. Raymond
gitlab at mg.gitlab.com
Wed Nov 2 19:09:33 UTC 2016
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
b8a35148 by Eric S. Raymond at 2016-11-02T15:09:22-04:00
Address Gitlab issue #136: Peers without rDNS are blank in pyntpq -p
This is really some sort of OS X bug.
- - - - -
1 changed file:
- pylib/util.py
Changes:
=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -35,7 +35,10 @@ def canonicalize_dns(hostname):
try:
name = socket.getnameinfo(sockaddr, socket.NI_NAMEREQD)
except socket.gaierror:
- return canonname.lower() + portsuffix
+ # On OS X, canonname is empty for hosts without rDNS.
+ # Fall back to the hostname.
+ canonicalized = canonname or hostname
+ return canonicalized.lower() + portsuffix
return name[0].lower() + portsuffix
def termsize():
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/b8a351481038994bf67641dcda5e64c9adef0d04
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161102/07060ec4/attachment.html>
More information about the vc
mailing list