From ea89ffdb54ecc2bfb34f7a3162f216207ddf13ff Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 16 Jun 2022 00:29:09 +0800 Subject: improve to send/recv empty file --- xmake/core/base/socket.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xmake/core/base/socket.lua') diff --git a/xmake/core/base/socket.lua b/xmake/core/base/socket.lua index 9a36c45a8..615f28a0c 100644 --- a/xmake/core/base/socket.lua +++ b/xmake/core/base/socket.lua @@ -353,6 +353,11 @@ function _instance:sendfile(file, opt) return -1, errors end + -- empty file? + if file:size() == 0 then + return -1, string.format("%s: send empty file!", self) + end + -- init start and last opt = opt or {} local start = opt.start or 1 -- cgit v1.3.1