[otrs-cvs] otrs/Kernel/System/VirtualFS FS.pm,1.2,1.2.4.1

"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-serv23334/Kernel/System/VirtualFS

Modified Files:
      Tag: rel-3_0
	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.2
retrieving revision 1.2.4.1
diff -2 -u -d -r1.2 -r1.2.4.1
--- FS.pm	10 Dec 2009 11:59:54 -0000	1.2
+++ FS.pm	3 Dec 2012 13:29:28 -0000	1.2.4.1
@@ -1,5 +1,5 @@
 # --
 # Kernel/System/VirtualFS/FS.pm - all virtual fs functions
-# Copyright (C) 2001-2009 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -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,18 +39,4 @@
     $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";
-    }
-    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";
-        }
-    }
-
     # create data dir
     if ( !-d $Self->{DataDir} ) {
@@ -58,4 +44,23 @@
     }
 
+    # 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, 0755 ) ) {
+        rmdir $Path;
+    }
+    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!";
+    }
+
     # config (not used right now)
     $Self->{Compress} = 0;
---------------------------------------------------------------------
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.