diff options
author | Kim Alvefur <zash@zash.se> | 2012-12-21 08:10:07 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2012-12-21 08:10:07 +0100 |
commit | 9a2939f64a722af33e84789336a8d2d11f8eacac (patch) | |
tree | 17b5b3c384b91db22ba4f9e3d7994593f41a3be8 /plugins | |
parent | 82a91911a2ebdb29bb2d2c156e05502c49fe3c77 (diff) | |
download | prosody-9a2939f64a722af33e84789336a8d2d11f8eacac.tar.gz prosody-9a2939f64a722af33e84789336a8d2d11f8eacac.zip |
mod_http_files: No use in closing a file handle if we couldn't open it
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http_files.lua | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua index d83e6f97..92c49e11 100644 --- a/plugins/mod_http_files.lua +++ b/plugins/mod_http_files.lua @@ -106,9 +106,11 @@ function serve_file(event, path) end else - local f = open(full_path, "rb"); - data = f and f:read("*a"); - f:close(); + local f, err = open(full_path, "rb"); + if f then + data = f:read("*a"); + f:close(); + end if not data then return 403; end |