Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2005 18:36:40 GMT
From:      soc-bushman <soc-bushman@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 80049 for review
Message-ID:  <200507121836.j6CIae5R081325@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=80049

Change 80049 by soc-bushman@soc-bushman_stinger on 2005/07/12 18:35:59

	bugfix in files_servent + testing system

Affected files ...

.. //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getservent.c#10 edit
.. //depot/projects/soc2005/nsswitch_cached/tests/common/Makefile#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/common/debug.c#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/common/debug.h#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/common/test.c#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/common/test.h#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/common_test/Makefile#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/common_test/common_test.c#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent/getservent.c#5 delete
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent/libc_private.h#2 delete
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent/namespace.h#2 delete
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent/netdb_private.h#2 delete
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent/nss_tls.h#2 delete
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent/reentrant.h#2 delete
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent/un-namespace.h#2 delete
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent_test/Makefile#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent_test/getservent.c#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent_test/getservent.h#1 add
.. //depot/projects/soc2005/nsswitch_cached/tests/getservent_test/getservent_test.c#1 add

Differences ...

==== //depot/projects/soc2005/nsswitch_cached/src/lib/libc/net/getservent.c#10 (text+ko) ====

@@ -352,7 +352,7 @@
 			continue;
 		}
 
-		rv = servent_unpack(line, serv, aliases, aliases_size, errnop);
+		rv = servent_unpack(buffer, serv, aliases, aliases_size, errnop);
 		if (rv !=0 ) {
 			if (*errnop == 0) {
 				rv = NS_NOTFOUND;
@@ -391,12 +391,12 @@
 		
 	} while (!(rv & NS_TERMINATE));
 	
-	if (!stayopen && st->fp!=NULL) {
+	if (!stayopen && st->fp != NULL) {
 		fclose(st->fp);
 		st->fp = NULL;
 	}
 	
-	if ((rv ==NS_SUCCESS) && (retval != NULL))
+	if ((rv == NS_SUCCESS) && (retval != NULL))
 		*(struct servent **)retval=serv;
 	
 	return (rv);
@@ -423,7 +423,11 @@
 		st->stayopen |= f;
 		break;
 	case ENDSERVENT:
-			st->stayopen = 0;
+		if (st->fp != NULL) {
+			fclose(st->fp);
+			st->fp = NULL;
+		}		
+		st->stayopen = 0;
 		break;
 	default:
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507121836.j6CIae5R081325>