From a40fe5413c4fc16d2965dbfb9821678a5c08d117 Mon Sep 17 00:00:00 2001 From: jah Date: Sun, 7 Feb 2016 15:11:24 +0000 Subject: [PATCH] Handle file io error messages on Windows which prepends the file path to the error string. --- scripts/whois-ip.nse | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/whois-ip.nse b/scripts/whois-ip.nse index 3cccba2e1..de7fc6914 100644 --- a/scripts/whois-ip.nse +++ b/scripts/whois-ip.nse @@ -1920,26 +1920,26 @@ function file_stat( path ) if f then f.close() writable = true - elseif err == 'Permission denied' then + elseif err:match('Permission denied') then writable = false end - elseif err == 'No such file or directory' then + elseif err:match('No such file or directory') then exists = false f, err = io.open(path, 'w') - if err == 'Permission denied' then - writable = false - elseif f then + if f then f.close() writable = true f, err = io.open(path, 'r') if f then f.close() readable = true - elseif err == 'Permission denied' then + elseif err:match('Permission denied') then readable = false end + elseif err:match('Permission denied') then + writable = false end - elseif err == 'Permission denied' then + elseif err:match('Permission denied') then exists = true -- probably readable = false end