1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

Correct term_add() caller to match documentation

term_add() is documented only to return a negative on error,
but term_set() was using the return value as an index into term[].
Because term_add() is going to change, correct term_set() by adding
an explicit call to term_find() to get the index.
This commit is contained in:
David Leonard
2018-02-07 23:26:46 +10:00
committed by Nick Patavalis
parent 93d52ad7bb
commit 5dd500996a

4
term.c
View File

@ -1261,11 +1261,11 @@ term_set(int fd,
i = term_find(fd);
if ( i < 0 ) {
ni = term_add(fd);
if ( ni < 0 ) {
if ( term_add(fd) < 0 ) {
rval = -1;
break;
}
ni = term_find(fd);
} else {
ni = i;
}