fix length after '\' getline string termination

This commit is contained in:
Hiltjo Posthuma
2016-02-25 21:42:36 +01:00
committed by sin
parent 58257275f0
commit e8eeb19fcd
5 changed files with 8 additions and 8 deletions

2
head.c
View File

@@ -15,7 +15,7 @@ head(FILE *fp, const char *fname, size_t n)
while (i < n && (len = getline(&buf, &size, fp)) > 0) {
fputs(buf, stdout);
i += (len && (buf[len - 1] == '\n'));
i += (buf[len - 1] == '\n');
}
free(buf);
if (ferror(fp))