summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2019-12-05 19:08:05 +0100
committerBoris Faure <billiob@gmail.com>2019-12-05 19:08:05 +0100
commita782ce61e2260431d4ecd878a3b8f48c9b609c75 (patch)
tree3c8b0fc3764ba248662e5e2825f1fa859fbe0380
parentb76bbbe45507e2c1c62e38b60f12c09eef176e15 (diff)
test return of ty_sb_add(). Closes CID1408482
-rw-r--r--src/bin/termiointernals.c16
-rw-r--r--src/bin/termpty.c18
2 files changed, 27 insertions, 7 deletions
diff --git a/src/bin/termiointernals.c b/src/bin/termiointernals.c
index 598c724..3d7c501 100644
--- a/src/bin/termiointernals.c
+++ b/src/bin/termiointernals.c
@@ -414,9 +414,21 @@ termio_internal_get_selection(Termio *sd, size_t *lenp)
414 414
415 if (isb.len) 415 if (isb.len)
416 { 416 {
417 int res;
417 if (isb.buf[isb.len - 1] != '\n' && i != end_y) 418 if (isb.buf[isb.len - 1] != '\n' && i != end_y)
418 ty_sb_add(&isb, "\n", 1); 419 {
419 ty_sb_add(&sb, isb.buf, isb.len); 420 res = ty_sb_add(&isb, "\n", 1);
421 if (res < 0)
422 {
423 ERR("failure to add newline to selection buffer");
424 }
425 }
426 res = ty_sb_add(&sb, isb.buf, isb.len);
427 if (res < 0)
428 {
429 ERR("failure to add %zd characters to selection buffer",
430 isb.len);
431 }
420 } 432 }
421 ty_sb_free(&isb); 433 ty_sb_free(&isb);
422 } 434 }
diff --git a/src/bin/termpty.c b/src/bin/termpty.c
index 502aa90..480fc36 100644
--- a/src/bin/termpty.c
+++ b/src/bin/termpty.c
@@ -1305,11 +1305,19 @@ termpty_write(Termpty *ty, const char *input, int len)
1305#if defined(ENABLE_FUZZING) 1305#if defined(ENABLE_FUZZING)
1306 return; 1306 return;
1307#endif 1307#endif
1308 ty_sb_add(&ty->write_buffer, input, len); 1308 int res = ty_sb_add(&ty->write_buffer, input, len);
1309 ecore_main_fd_handler_active_set(ty->hand_fd, 1309
1310 ECORE_FD_ERROR | 1310 if (res < 0)
1311 ECORE_FD_READ | 1311 {
1312 ECORE_FD_WRITE); 1312 ERR("failure to add %d characters to write buffer", len);
1313 }
1314 else
1315 {
1316 ecore_main_fd_handler_active_set(ty->hand_fd,
1317 ECORE_FD_ERROR |
1318 ECORE_FD_READ |
1319 ECORE_FD_WRITE);
1320 }
1313} 1321}
1314 1322
1315struct screen_info 1323struct screen_info