changeset 18:52000ae7a6cf

ueda/libunet/unetrd.c: close the stdio stream on EOF
author Space Falcon <falcon@ivan.Harhan.ORG>
date Sun, 02 Aug 2015 01:23:09 +0000
parents e86258830e19
children 1d4c693b8f35
files ueda/libunet/unetrd.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ueda/libunet/unetrd.c	Sun Aug 02 01:13:43 2015 +0000
+++ b/ueda/libunet/unetrd.c	Sun Aug 02 01:23:09 2015 +0000
@@ -170,8 +170,10 @@
 
 	/* read lines until we get a non-empty, non-comment line or EOF */
 	for (;;) {
-		if (!fgets(linebuf, sizeof linebuf, state->stream))
+		if (!fgets(linebuf, sizeof linebuf, state->stream)) {
+			fclose(state->stream);
 			return(0);
+		}
 		state->lineno++;
 		cp = index(linebuf, '\n');
 		if (!cp) {