test return of ty_sb_add(). Closes CID1408482

This commit is contained in:
Boris Faure 2019-12-05 19:08:05 +01:00
parent b76bbbe455
commit a782ce61e2
Signed by: borisfaure
GPG Key ID: EAA9CD729F522998
2 changed files with 27 additions and 7 deletions

View File

@ -414,9 +414,21 @@ termio_internal_get_selection(Termio *sd, size_t *lenp)
if (isb.len)
{
int res;
if (isb.buf[isb.len - 1] != '\n' && i != end_y)
ty_sb_add(&isb, "\n", 1);
ty_sb_add(&sb, isb.buf, isb.len);
{
res = ty_sb_add(&isb, "\n", 1);
if (res < 0)
{
ERR("failure to add newline to selection buffer");
}
}
res = ty_sb_add(&sb, isb.buf, isb.len);
if (res < 0)
{
ERR("failure to add %zd characters to selection buffer",
isb.len);
}
}
ty_sb_free(&isb);
}

View File

@ -1305,11 +1305,19 @@ termpty_write(Termpty *ty, const char *input, int len)
#if defined(ENABLE_FUZZING)
return;
#endif
ty_sb_add(&ty->write_buffer, input, len);
ecore_main_fd_handler_active_set(ty->hand_fd,
ECORE_FD_ERROR |
ECORE_FD_READ |
ECORE_FD_WRITE);
int res = ty_sb_add(&ty->write_buffer, input, len);
if (res < 0)
{
ERR("failure to add %d characters to write buffer", len);
}
else
{
ecore_main_fd_handler_active_set(ty->hand_fd,
ECORE_FD_ERROR |
ECORE_FD_READ |
ECORE_FD_WRITE);
}
}
struct screen_info