[uClibc-cvs] uClibc/libc/inet getservice.c,1.7,1.8

Erik Andersen andersen at uclibc.org
Sun Dec 28 08:25:19 UTC 2003


Update of /var/cvs/uClibc/libc/inet
In directory nail:/tmp/cvs-serv15792

Modified Files:
	getservice.c 
Log Message:
Fix a really dumb bug introduced in version 1.4 of this file (a patch for ipv6
support) which could cause things like EOF and read errors while reading
/etc/services to always return a TRY_AGAIN.  The perl test suite would alloc a
larger buffer and try again until all memory was exhausted.  When we get a read
error, or EOF, it means we didn't get what we wanted, and so we should return
an error.  Doing so fixes the failing perl 5.8.2 test.
 -Erik


Index: getservice.c
===================================================================
RCS file: /var/cvs/uClibc/libc/inet/getservice.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- getservice.c	28 Dec 2003 07:41:24 -0000	1.7
+++ getservice.c	28 Dec 2003 08:25:16 -0000	1.8
@@ -163,12 +163,14 @@
 
     if (servf == NULL && (servf = fopen(_PATH_SERVICES, "r" )) == NULL) {
 	UNLOCK;
+	errno=EIO;
 	return errno;
     }
 again:
     if ((p = fgets(line, BUFSIZ, servf)) == NULL) {
 	UNLOCK;
-	return TRY_AGAIN;
+	errno=EIO;
+	return errno;
     }
     if (*p == '#')
 	goto again;




More information about the uClibc-cvs mailing list