Don't drop the host aliases pointer vector in `gethostent`
Fixes #130 (closed).
There are pointers to this vector in HOST_ENTRY
so we must keep it around for
as long as HOST_ENTRY
exists. At least this is my understand of why the above bug appears. Though I still don't understand why it bug only appears sometimes and not an every call to gethostent
.
With this change all pointers in HOST_ENTRY
reference a value that is owned by one of the other static variables in the module. It would probably be nicer if _HOST_ALIASES
would take ownership of the local variable _host_aliases
and HOST_ALIASES
take ownership of host_aliases
, and not the other way around, as it stands now, but I don't know who relies on the contents of the static variables, so I didn't want to change too much. Maybe someone with more knowledge of the module can have a look. If it is doesn't break anything or isn't too much trouble I think that would be a worthwhile change.
All local tests passed for me with this change.