[otrs-cvs] otrs/Kernel/System/VirtualFS FS.pm,1.4,1.5

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/Kernel/System/VirtualFS
In directory lancelot:/tmp/cvs-serv18628/Kernel/System/VirtualFS

Modified Files:
	FS.pm 
Log Message:
 - 2012-12-03 Fixed bug#8933 - ArticleStorageInit permission check problem.

Author: mg

Index: FS.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/VirtualFS/FS.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -2 -u -d -r1.4 -r1.5
--- FS.pm	20 Nov 2012 16:02:03 -0000	1.4
+++ FS.pm	3 Dec 2012 11:38:40 -0000	1.5
@@ -14,6 +14,6 @@
 use strict;
 use warnings;
-use File::Path;
-use File::Basename;
+
+use Time::HiRes qw();
 
 # to get it writable for the otrs group (just in case)
@@ -39,16 +39,21 @@
     $Self->{Permission} = '664';
 
-    # check fs write permissions!
-    my $Path = "$Self->{DataDir}/check_permissions.$$";
-    if ( -d $Path ) {
-        File::Path::rmtree( [$Path] ) || die "Can't remove $Path: $!\n";
+    # Check fs write permissions.
+    # Generate a thread-safe article check directory.
+    my ( $Seconds, $Microseconds ) = Time::HiRes::gettimeofday();
+    my $PermissionCheckDirectory
+        = "check_permissions_${$}_" . ( int rand 1_000_000_000 ) . "_${Seconds}_${Microseconds}";
+    my $Path = "$Self->{DataDir}/$PermissionCheckDirectory";
+
+    if ( mkdir( $Path, 022 ) ) {
+        rmdir $Path;
     }
-    if ( mkdir( "$Self->{DataDir}/check_permissions_$$", 022 ) ) {
-        if ( !rmdir("$Self->{DataDir}/check_permissions_$$") ) {
-            die "Can't remove $Self->{DataDir}/check_permissions_$$: $!\n";
-        }
-        if ( File::Path::mkpath( [$Path], 0, 0775 ) ) {
-            File::Path::rmtree( [$Path] ) || die "Can't remove $Path: $!\n";
-        }
+    else {
+        my $Error = $!;
+        $Self->{LogObject}->Log(
+            Priority => 'notice',
+            Message  => "Can't create $Path: $Error, try: \$OTRS_HOME/bin/otrs.SetPermissions.pl!",
+        );
+        die "Can't create $Path: $Error, try: \$OTRS_HOME/bin/otrs.SetPermissions.pl!";
     }
 
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.