File: 01_access_check_use_filetest_access.patch

package info (click to toggle)
libmail-box-perl 2.117-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,828 kB
  • ctags: 1,564
  • sloc: perl: 23,381; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,520 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Description: Use filetest 'access'
 filetest 'access' is slower, but works correctly if we have a
 filesystem with ACLs.
Forwarded: no
Author: Damyan Ivanov <dmn@debian.org>
Origin: vendor
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2014-05-03
--- a/lib/Mail/Box/Dir.pm
+++ b/lib/Mail/Box/Dir.pm
@@ -59,9 +59,13 @@
 
     # Check if we can write to the folder, if we need to.
 
-    if($self->writable && -e $directory && ! -w $directory)
-    {   $self->log(WARNING=> "Folder directory $directory is write-protected.");
-        $self->{MB_access} = 'r';
+    {   # filetest 'access' is slower, but works correctly if we have a
+	# filesystem with ACLs
+	use filetest 'access';
+	if($self->writable && -e $directory && ! -w $directory)
+	{   $self->log(WARNING=> "Folder directory $directory is write-protected.");
+	    $self->{MB_access} = 'r';
+	}
     }
 
     $self;
--- a/lib/Mail/Box/File.pm
+++ b/lib/Mail/Box/File.pm
@@ -93,9 +93,13 @@
 
     # Check if we can write to the folder, if we need to.
 
-    if($self->writable && ! -w $filename)
-    {   $self->log(WARNING => "Folder $self file $filename is write-protected.");
-        $self->{MB_access} = 'r';
+    {   # filetest 'access' is slower, but works correctly if we have a
+	# filesystem with ACLs
+	use filetest 'access';
+	if($self->writable && ! -w $filename)
+	{   $self->log(WARNING => "Folder $self file $filename is write-protected.");
+	    $self->{MB_access} = 'r';
+	}
     }
 
     # Start parser if reading is required.