liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit a258456f25aea8a5d9a98b4caa053848cc900c00
parent 71e37f1b96d7964ba3644772ee5674a435eeefd4
Author: Daniel Barlow <dan@telent.net>
Date:   Tue,  4 Oct 2022 22:02:33 +0100

check return value of bind

is common to forget to run this as root, in which case we would like
to see the permission denied error when it tries to open port 69

Diffstat:
Mpkgs/tufted/tftp.lua | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pkgs/tufted/tftp.lua b/pkgs/tufted/tftp.lua @@ -339,7 +339,8 @@ function tftp:listen(rrq_generator_callback, wrq_generator_callback, hosts, port local logfile = logfile or io.stderr --listen on all given addresses, default to localhost if not given for i, address in pairs((type(hosts) == 'table' and hosts) or (hosts ~= nil and{hosts}) or {'127.0.0.1'}) do - socket:bind(address, port) + local ok, err = socket:bind(address, port) + if not ok then error(err .. " binding to " .. address .. ":" .. port) end end --[[The main event loop does two things: