mirror of
https://github.com/openbsd/src.git
synced 2026-04-16 02:04:12 +00:00
Improve OpenBSD::Unveil POD
The choice of variable names made it somewhat unclear what arguments to pass and made it seem the interface might differ from unveil(2). ok dgl@
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
# $OpenBSD: Unveil.pm,v 1.1 2019/07/09 20:41:54 afresh1 Exp $ #
|
||||
# $OpenBSD: Unveil.pm,v 1.2 2026/03/30 00:00:04 afresh1 Exp $ #
|
||||
package OpenBSD::Unveil;
|
||||
|
||||
use 5.028;
|
||||
@@ -12,7 +12,7 @@ our %EXPORT_TAGS = ( 'all' => [qw( unveil )] );
|
||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||
our @EXPORT = qw( unveil ); ## no critic 'export'
|
||||
|
||||
our $VERSION = '0.02';
|
||||
our $VERSION = '0.03';
|
||||
|
||||
require XSLoader;
|
||||
XSLoader::load( 'OpenBSD::Unveil', $VERSION );
|
||||
@@ -38,10 +38,11 @@ OpenBSD::Unveil - Perl interface to OpenBSD unveil(2)
|
||||
use OpenBSD::Unveil;
|
||||
|
||||
my $file = "/usr/share/dict/words";
|
||||
|
||||
unveil( $file, "r" ) || die "Unable to unveil: $!";
|
||||
unveil() || die "Unable to lock unveil: $!";
|
||||
open my $fh, '<', $file or die "Unable to open $file: $!";
|
||||
|
||||
open my $fh, '<', $file or die "Unable to open $file: $!";
|
||||
print grep { /unveil/i } readline($fh);
|
||||
close $fh;
|
||||
|
||||
@@ -60,9 +61,11 @@ Exports L</unveil> by default.
|
||||
|
||||
Perl interface to L<unveil(2)>.
|
||||
|
||||
unveil($paths, $permissions)
|
||||
unveil($path, $permissions)
|
||||
unveil() # to lock
|
||||
|
||||
Takes a string C<$path> and a string of C<$permissions>.
|
||||
Calling with no arguments disables future calls to C<unveil>.
|
||||
Returns true on success, returns false and sets $! on failure.
|
||||
Throws an exception on incorrect number of parameters.
|
||||
|
||||
@@ -72,6 +75,8 @@ L<unveil(2)>
|
||||
|
||||
L<http://man.openbsd.org/unveil.2>
|
||||
|
||||
L<OpenBSD::Pledge>
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Andrew Fresh, E<lt>afresh1@OpenBSD.orgE<gt>
|
||||
|
||||
Reference in New Issue
Block a user