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
This commit is contained in:
vvelox 2016-01-09 12:54:10 +00:00
parent e13463251f
commit c903e17c9d
2 changed files with 18 additions and 17 deletions

View File

@ -1,4 +1,8 @@
Revision history for File-Permissions-Unix 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 0.0.0 2011-08-14/05:05
-Initial release. -Initial release.

View File

@ -10,11 +10,11 @@ File::Permissions::Unix - A simple object oriented interface to handling file pe
=head1 VERSION =head1 VERSION
Version 0.0.0 Version 0.1.0
=cut =cut
our $VERSION = '0.0.0'; our $VERSION = '0.1.0';
=head1 SYNOPSIS =head1 SYNOPSIS
@ -110,13 +110,6 @@ sub chmod{
return undef; 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 #try to chmod the file
if( ! chmod( oct($self->{mode}), $file )){ if( ! chmod( oct($self->{mode}), $file )){
$self->{error}=4; $self->{error}=4;
@ -171,7 +164,7 @@ sub setMode{
# make sure it is a valid mode # make sure it is a valid mode
if ( $mode !~ /^[01246][01234567][01234567][01234567]$/ ){ if ( $mode !~ /^[01246][01234567][01234567][01234567]$/ ){
$self->{error}=1; $self->{error}=1;
$self->{errorString}=''; $self->{errorString}='"'.$mode.'" is not a valid mode';
return $self; return $self;
} }
@ -209,15 +202,13 @@ sub setModeFromFile{
return undef; 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 #stat the file and get it
my $mode = (stat($file))[2] & 07777; 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); $mode=sprintf("%04o", $mode);
$self->{mode}=$mode; $self->{mode}=$mode;
@ -243,10 +234,16 @@ No file specified.
The file does not exist. The file does not exist.
This has been depreciated as it introduces a possible race condition.
=head2 4 =head2 4
Failed to chmod the file. Failed to chmod the file.
=head2 5
Failed too stat the file.
=head1 AUTHOR =head1 AUTHOR
Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >> Zane C. Bowers-Hadley, C<< <vvelox at vvelox.net> >>