diff options
author | Andinus <andinus@nand.sh> | 2020-06-11 23:39:10 +0530 |
---|---|---|
committer | Andinus <andinus@nand.sh> | 2020-06-11 23:39:10 +0530 |
commit | 245aebe3da915afc0feafc7257f025e2e66a987f (patch) | |
tree | bdc16e833baea8da1eeec29fd3376b4f97aa6b77 | |
parent | e71097613ba52a9680bce2eaa627f3659dd01038 (diff) | |
download | ara-245aebe3da915afc0feafc7257f025e2e66a987f.tar.gz |
Fix CRITICAL error: unveil was overriden by custom sub
sub declarations are decided on compile time irrespective of surrounding if blocks so unveil sub was getting overriden by { return 1; } everytime which means that basically unveil wasn't running at all. And this is why I should've written tests or maybe even add a debug flag that would warn each time custom unveil is called.
-rwxr-xr-x | ara.pl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ara.pl b/ara.pl index 4df7f72..4afb9d4 100755 --- a/ara.pl +++ b/ara.pl @@ -10,11 +10,14 @@ use Getopt::Long qw( GetOptions ); use JSON::MaybeXS qw( decode_json ); use constant is_OpenBSD => $^O eq "openbsd"; -if (is_OpenBSD) { - require OpenBSD::Unveil; - OpenBSD::Unveil->import; -} else { - sub unveil { return 1; } +require OpenBSD::Unveil + if is_OpenBSD; +sub unveil { + if (is_OpenBSD) { + return OpenBSD::Unveil::unveil(@_); + } else { + return 1; + } } # Unveil @INC. |