From Bugzilla Helper: User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) Description of problem: gethostbyaddr leaks a file handle when it cannot look up the address in the /etc/hosts file. Placing the ip in question in the hosts file fixes the problem, removing it causes the problem. char * pr_addr(unsigned int addr) { struct hostent *hp; static char buf[80]; //file handle leak occurs right here when addr not in hosts file hp = gethostbyaddr((char *)&addr, 4, AF_INET); if ( hp == NULL ) //sprintf(buf, "%s", inet_ntoa(*(struct in_addr *)&addr)); sprintf(buf,"pr_addr : could not resolve host.\n"); else sprintf(buf, "%s (%s)", hp->h_name, inet_ntoa(*(struct in_addr *)&addr)); return(buf); } How reproducible: Always Steps to Reproduce: 1.See sample code above. 2. 3. Additional info:
Move to the right product and component
Which exact glibc version are you using? How does your /etc/nsswitch.conf look like (does it search dns too, or just files, or what)? What exact addresses are you trying (can you cook up a self contained testcase, not just a single function)? What does strace show up?
Cannot reproduce this.