| Summary: | EAI_NODATA and EAI_NONAME are define to be the same. | ||
|---|---|---|---|
| Product: | Base System | Reporter: | marka |
| Component: | bin | Assignee: | Hajimu UMEMOTO <ume> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
Responsible Changed From-To: freebsd-bugs->ume Assign to responsible committer State Changed From-To: open->closed I've just removed EAI_NODATA. |
EAI_NODATA and EAI_NONAME are defined to be the same. This breaks switch statements that look at result codes from getaddrinfo(). This change has made every portable application that does this have to change from #ifdef EAI_NODATA case EAI_NODATA: #endif to #if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME) case EAI_NODATA: #endif Having a unused result code doesn't hurt anyone. Removing the result code causes some pain but portable applications already have that pain. EAI_NODATA doesn't exist on all platforms already. Defining EAI_NODATA to be EAI_NONAME is just plain wrong as it breaks existing unbroken code. I really am not looking forward to the bug reports that I will have to handle about this. I've already got one. Fix: Remove the offending #define. How-To-Repeat: #include <netdb.h> main() { int i = 0; /* i = getaddrinfo(....); */ switch (i) { case EAI_NONAME: printf("EAI_NONAME\n"); break; #ifdef EAI_NODATA case EAI_NODATA: printf("EAI_NODATA\n"); break; #endif default: printf("default\n"); } }