certifix

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

commit 9ef19472118411cac802253fa2284e3fb800511d
parent ba3795e3f2052e15a9c639c3557576677644030b
Author: Daniel Barlow <dan@telent.net>
Date:   Thu, 26 Sep 2024 22:11:37 +0100

check io.open return

Diffstat:
Mmain.fnl | 16++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/main.fnl b/main.fnl @@ -8,6 +8,12 @@ (local pkey (require :openssl.pkey)) (local bignum (require :openssl.bignum)) +;; ncall is the opposite of pcall: "non-protected call" +(macro ncall [f] + `(case ,f + ok# ok# + (nil err#) (error err#))) + (fn string->bignum [bytes] (bignum.new (string.format @@ -34,10 +40,10 @@ (out:write_chunk text true)) (fn slurp [filename] - (with-open [f (io.open filename "r")] (f:read "*a"))) + (with-open [f (ncall (io.open filename "r"))] (f:read "*a"))) (fn read-line [filename] - (with-open [f (io.open filename "r")] (f:read "l"))) + (with-open [f (ncall (io.open filename "r"))] (f:read "l"))) (fn assoc [tbl k v & more] (tset tbl k v) @@ -106,12 +112,6 @@ _ (send-error out 404 "not found")))) -;; ncall is the opposite of pcall: "non-protected call" -(macro ncall [f] - `(case ,f - ok# ok# - (nil err#) (error err#))) - (fn new-server [] (let [(addr port) (string.match options.bind-address "(.+):(%d+)$")] (case (server.listen