summaryrefslogtreecommitdiff
path: root/development/as31/as31-fix-duplicate-line.patch
blob: 2d9dfc1e98f3d5d3b1836c99dd7953d23c95fa83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
diff --git a/as31/run.c b/as31/run.c
index 28c5317..9e5263b 100644
--- a/as31/run.c
+++ b/as31/run.c
@@ -113,7 +113,8 @@ int run_as31(const char *infile, int lst, int use_stdout,
 	}
 
 	while (!feof(finPre)) {
-		getline(&lineBuffer,&sizeBuf,finPre);
+		if (getline(&lineBuffer,&sizeBuf,finPre) == -1)
+			break;
 		if ((includePtr=strstr(lineBuffer,INC_CMD))) {
 			includePtr=includePtr+strlen(INC_CMD);
 			while ((*includePtr==' ')||		//move includePtr to filename
@@ -138,7 +139,8 @@ int run_as31(const char *infile, int lst, int use_stdout,
 				mesg_f("Cannot open include file: %s\n",includePtr);
 			} else {
 				while (!feof(includeFile)) {
-					getline(&incLineBuffer,&incSizeBuf,includeFile);
+					if (getline(&incLineBuffer,&incSizeBuf,includeFile) == -1)
+						break;
 					fprintf(fin,"%s",incLineBuffer);
 					if (strlen(incLineBuffer)) {
 						incLineCount++;