Skip to content

Commit

Permalink
fix(socket): Fix return value of send and sendfile
Browse files Browse the repository at this point in the history
The send function does not return an error when it sends fail.

Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 authored and gl-zhaojianhui committed Apr 20, 2024
1 parent 6269331 commit dc24a0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ static int lua_sendk(lua_State *L, int status, lua_KContext ctx)
return lua_yieldk(L, 0, ctx, lua_sendk);
}

lua_pushnil(L);
if (errno == EPIPE)
lua_pushliteral(L, "closed");
else
Expand Down Expand Up @@ -569,7 +570,7 @@ static int lua_sendfilek(lua_State *L, int status, lua_KContext ctx)
}

close(sock->snd.fd);

lua_pushnil(L);
if (errno == EPIPE)
lua_pushliteral(L, "closed");
else
Expand Down

0 comments on commit dc24a0d

Please sign in to comment.