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

4
sed.c
View File

@@ -441,8 +441,8 @@ read_line(FILE *f, String *s)
eprintf("getline:");
return EOF;
}
if (s->str[--len] == '\n')
s->str[len] = '\0';
if (s->str[len] == '\n')
s->str[--len] = '\0';
return 0;
}