Really fix off by one error.
This commit is contained in:
		| @@ -121,10 +121,10 @@ char *rc_getline (FILE *fp) | |||||||
| 		p = line + last; | 		p = line + last; | ||||||
| 		fgets (p, BUFSIZ, fp); | 		fgets (p, BUFSIZ, fp); | ||||||
| 		last += strlen (p); | 		last += strlen (p); | ||||||
| 	} while (! feof (fp) && line[last] != '\n'); | 	} while (! feof (fp) && line[last - 1] != '\n'); | ||||||
|  |  | ||||||
| 	/* Trim the trailing newline */ | 	/* Trim the trailing newline */ | ||||||
| 	if (line[last] == '\n') | 	if (line[--last] == '\n') | ||||||
| 		line[last] = '\0'; | 		line[last] = '\0'; | ||||||
|  |  | ||||||
| 	return (line); | 	return (line); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user