Package: durep / 0.9-3

20_invalid_dirhandle.diff Patch series | download
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
Description: Let directory handle trickle down in recursive calls
 Recent version of Perl has stricter policy regarding globally
 defined directory handles. The original source uses a fixed
 directory handle in a recursive call sequence. The patch makes
 these handles into standard variables. (Closes: #482061)
Forwarded: no
Author: Rupa Shomaker <rupa@rupa.com>
Last-Update: 2010-01-09
diff -u durep-0.9.orig/durep durep-0.9/durep
--- durep-0.9.orig/durep
+++ durep-0.9/durep
@@ -175,6 +175,7 @@
   my $coalesced_size = 0;
   my $node = {};
   my $temp;
+  my $dirhandle;

   $node->{ID} = $next_id++;
   if(defined $parent) {
@@ -196,9 +197,9 @@

   $node->{TYPE} &= $TYPE_COLLAPSED unless $store;

-  opendir(DIR, $dir) or warn "Unable to open dir '$dir': $!\n" and return $node;
+  opendir($dirhandle, $dir) or warn "Unable to open dir '$dir': $!\n" and return $node;

-  foreach(readdir(DIR)) {
+  foreach(readdir($dirhandle)) {
     @stats = lstat "$dir/$_" or warn "Unable to lstat '$dir/$_': $!\n" and next;

     $node->{MTIME} = $stats[9] if($_ eq ".");
@@ -247,7 +248,7 @@
     $file_count++;
     $node->{FCOUNT}++;
   }
-  closedir(DIR);
+  closedir($dirhandle);

   if($coalesced_count) {
     if($store) {