ignore extra fields in a hosts file, since apparently some apps are putting comments on the same line (?).

This commit is contained in:
Robey Pointer 2009-07-19 20:26:44 -07:00
parent b4220657be
commit 62bc0ad79a
1 changed files with 2 additions and 1 deletions

View File

@ -53,9 +53,10 @@ class HostKeyEntry:
@type line: str @type line: str
""" """
fields = line.split(' ') fields = line.split(' ')
if len(fields) != 3: if len(fields) < 3:
# Bad number of fields # Bad number of fields
return None return None
fields = fields[:3]
names, keytype, key = fields names, keytype, key = fields
names = names.split(',') names = names.split(',')