GNOME Bugzilla – Bug 336391
Possible error in EAI_ADDRFAMILY handling
Last modified: 2006-07-13 17:52:00 UTC
The libgnomevfs/gnome-vfs-resolve.c has a switch case in the _gnome_vfs_result_from_gai_error that converts the given error number to an appropriate gnome-vfs error code. However, there is a little problem when handling EAI_ADDRFAMILY, hidden by the #ifdef "pollution". Consider a system that has EAI_ADDRFAMILY but lacks EAI_NODATA. In that situation, the EAI_ADDRFAMILY case will fall through EAI_SYSTEM, returning a non-sense value. Or, e.g. if EAI_SYSTEM is not available, then the code will fall through to EAI_AGAIN, returning that there was a name server error. Similarly, if EAI_NODATA is available, the code will return that there is no address (or whatever the error means, I do not know exactly). Summarizing: given that many entries of that switch construction are conditionally built, EAI_ADDRFAMILY should explicitly return its appropriate error value so that it does not depend on the other macros being defined. If I understood it correctly, an EAI_ADDRFAMILY error should be converted to GNOME_VFS_ERROR_HOST_HAS_NO_ADDRESS. If so, this is what the attached patch does.
Created attachment 62239 [details] [review] Proposed patch.
Thanks for the patch. Patch is committed to cvs HEAD.