Browse Source

Bump to 0.1.0 and fix a possible race condition.


git-svn-id: svn://127.0.0.1/Perl/File::Permissions::Unix/trunk@881 0c1c3402-1be1-de11-8092-0022686faf23
master
vvelox 3 years ago
parent
commit
c903e17c9d
2 changed files with 18 additions and 17 deletions
  1. 4
    0
      File-Permissions-Unix/Changes
  2. 14
    17
      File-Permissions-Unix/lib/File/Permissions/Unix.pm

+ 4
- 0
File-Permissions-Unix/Changes View File

@@ -1,4 +1,8 @@
Revision history for File-Permissions-Unix

0.1.0 2016-01-09/07:00
-Remove the file existence check to remove a possible race condition.
This also depreciates error 3.

0.0.0 2011-08-14/05:05
-Initial release.

+ 14
- 17
File-Permissions-Unix/lib/File/Permissions/Unix.pm View File

@@ -10,11 +10,11 @@ File::Permissions::Unix - A simple object oriented interface to handling file pe

=head1 VERSION

Version 0.0.0
Version 0.1.0

=cut

our $VERSION = '0.0.0';
our $VERSION = '0.1.0';

=head1 SYNOPSIS

@@ -110,13 +110,6 @@ sub chmod{
return undef;
}

#make sure the item exists
if ( ! -e $file ){
$self->{error}=3;
$self->{errorString}='"'.$file.'" does not exist';
return undef;
}

#try to chmod the file
if( ! chmod( oct($self->{mode}), $file )){
$self->{error}=4;
@@ -171,7 +164,7 @@ sub setMode{
# make sure it is a valid mode
if ( $mode !~ /^[01246][01234567][01234567][01234567]$/ ){
$self->{error}=1;
$self->{errorString}='';
$self->{errorString}='"'.$mode.'" is not a valid mode';
return $self;
}

@@ -209,15 +202,13 @@ sub setModeFromFile{
return undef;
}

#make sure the item exists
if ( ! -e $file ){
$self->{error}=3;
$self->{errorString}='"'.$file.'" does not exist';
return undef;
}

#stat the file and get it
my $mode = (stat($file))[2] & 07777;
if ( !defined( $mode ) ){
$self->{error}=5;
$self->{errorString}='Failed to stat the file "'.$file.'"';
return $self;
}
$mode=sprintf("%04o", $mode);

$self->{mode}=$mode;
@@ -243,10 +234,16 @@ No file specified.

The file does not exist.

This has been depreciated as it introduces a possible race condition.

=head2 4

Failed to chmod the file.

=head2 5

Failed too stat the file.

=head1 AUTHOR

Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >>

Loading…
Cancel
Save