summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortiptorrent development team <tiptorrent@soleta.eu>2021-09-13 11:59:44 +0200
committertiptorrent development team <tiptorrent@soleta.eu>2021-09-29 15:48:18 +0200
commit21aa4a9315921413743e2aa006f6e1102ff71c63 (patch)
treed1178b02866f8fd21d963e4885ad8d51cf49ae13
parent7a04638c320c61eb52c0a849fc8cf5ddd6e1ad8c (diff)
check sendfile error
-rw-r--r--src/handler.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/handler.c b/src/handler.c
index b283ea6..8e81c1f 100644
--- a/src/handler.c
+++ b/src/handler.c
@@ -164,7 +164,8 @@ int tip_client_state_process_payload_reply(struct tip_client *cli)
int tip_client_state_process_payload_bulk(struct tip_client *cli)
{
- sendfile(tip_client_socket(cli), cli->fd, &cli->offset, BLOCK);
+ if (sendfile(tip_client_socket(cli), cli->fd, &cli->offset, BLOCK) < 0)
+ return -1;
if (cli->offset >= cli->size) {
cli->state = TIP_CLIENT_CLOSE_WAIT;