diff ueda/libunet/unetrd.c @ 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 faeb83c43f1c
children dda8e455c863
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) {