Remove host entry if it is the last alias

This commit is contained in:
Thomas S Hatch 2011-05-29 23:26:42 -06:00
parent 782574b58e
commit b0fe7c8647

View File

@ -122,7 +122,10 @@ def rm_host(ip, alias):
if existing == alias:
continue
newline += '\t' + existing
lines[ind] = newline
if newline.strip() == ip:
lines[ind] = ''
else:
lines[ind] = newline
open(hfn, 'w+').writelines(lines)
return True