Date: Thu, 15 Jan 2004 08:22:27 +1100 (EST) From: Mark Andrews <marka@isc.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/61369: EAI_NODATA and EAI_NONAME are define to be the same. Message-ID: <200401142122.i0ELMR55070808@drugs.dv.isc.org> Resent-Message-ID: <200401142130.i0ELUDF7053765@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 61369 >Category: bin >Synopsis: EAI_NODATA and EAI_NONAME are define to be the same. >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jan 14 13:30:13 PST 2004 >Closed-Date: >Last-Modified: >Originator: Mark Andrews >Release: FreeBSD 5.2 i386 >Organization: ISC >Environment: FreeBSD 5.2 $FreeBSD: src/include/netdb.h,v 1.30 2003/10/24 06:53:12 ume Exp $ >Description: 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. >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"); } } >Fix: Remove the offending #define. >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401142122.i0ELMR55070808>