[vhffs-dev] [1878] File::Path::rmtree now aborts if it will remove the cwd |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1878
Author: gradator
Date: 2011-07-23 00:23:16 +0200 (Sat, 23 Jul 2011)
Log Message:
-----------
File::Path::rmtree now aborts if it will remove the cwd
Modified Paths:
--------------
branches/vhffs-4.3/vhffs-robots/src/mail_deleteboxes.pl
trunk/vhffs-robots/src/mail_deleteboxes.pl
Modified: branches/vhffs-4.3/vhffs-robots/src/mail_deleteboxes.pl
===================================================================
--- branches/vhffs-4.3/vhffs-robots/src/mail_deleteboxes.pl 2011-07-21 13:04:36 UTC (rev 1877)
+++ branches/vhffs-4.3/vhffs-robots/src/mail_deleteboxes.pl 2011-07-22 22:23:16 UTC (rev 1878)
@@ -55,16 +55,16 @@
if( defined $mail ) {
my $dir = $mail->get_box_dir( $b->{local_part} );
- if( -d $dir ) {
- if( chdir( $dir ) ) {
- if( defined $mailconf->{'archives_dir'} && -d $mailconf->{'archives_dir'} ) {
- my $cmd = 'tar cf '.$mailconf->{'archives_dir'}.'/'.time().'_'.$b->{local_part}.'@'.$b->{domain}.'.tar . 1> /dev/null 2> /dev/null';
- system( $cmd );
- }
- File::Path::rmtree($dir);
- # Remove the letter/ directory if empty
- rmdir dirname($dir);
+ if( -d $dir && chdir($dir) ) {
+ if( defined $mailconf->{'archives_dir'} && -d $mailconf->{'archives_dir'} ) {
+ my $cmd = 'tar cf '.$mailconf->{'archives_dir'}.'/'.time().'_'.$b->{local_part}.'@'.$b->{domain}.'.tar . 1> /dev/null 2> /dev/null';
+ system( $cmd );
}
+ # File::Path::rmtree abort if $dir is cwd
+ chdir('..');
+ File::Path::rmtree($dir);
+ # Remove the letter/ directory if empty
+ rmdir dirname($dir);
}
$mail->delbox( $b->{local_part} );
}
Modified: trunk/vhffs-robots/src/mail_deleteboxes.pl
===================================================================
--- trunk/vhffs-robots/src/mail_deleteboxes.pl 2011-07-21 13:04:36 UTC (rev 1877)
+++ trunk/vhffs-robots/src/mail_deleteboxes.pl 2011-07-22 22:23:16 UTC (rev 1878)
@@ -55,16 +55,16 @@
if( defined $mail ) {
my $dir = $mail->get_box_dir( $b->{local_part} );
- if( -d $dir ) {
- if( chdir( $dir ) ) {
- if( defined $mailconf->{'archives_dir'} && -d $mailconf->{'archives_dir'} ) {
- my $cmd = 'tar cf '.$mailconf->{'archives_dir'}.'/'.time().'_'.$b->{local_part}.'@'.$b->{domain}.'.tar . 1> /dev/null 2> /dev/null';
- system( $cmd );
- }
- File::Path::rmtree($dir);
- # Remove the letter/ directory if empty
- rmdir dirname($dir);
+ if( -d $dir && chdir($dir) ) {
+ if( defined $mailconf->{'archives_dir'} && -d $mailconf->{'archives_dir'} ) {
+ my $cmd = 'tar cf '.$mailconf->{'archives_dir'}.'/'.time().'_'.$b->{local_part}.'@'.$b->{domain}.'.tar . 1> /dev/null 2> /dev/null';
+ system( $cmd );
}
+ # File::Path::rmtree abort if $dir is cwd
+ chdir('..');
+ File::Path::rmtree($dir);
+ # Remove the letter/ directory if empty
+ rmdir dirname($dir);
}
$mail->delbox( $b->{local_part} );
}
- Messages sorted by: [ date | thread ]
- Prev by Date:
[vhffs-dev] [1877] using "git config" instead of git-config
- Next by Date:
[vhffs-dev] [1879] backported commits 1714, 1715, 1874, 1875, 1876, 1877 to 4.3 branch
- Previous by thread:
[vhffs-dev] [1877] using "git config" instead of git-config
- Next by thread:
[vhffs-dev] [1879] backported commits 1714, 1715, 1874, 1875, 1876, 1877 to 4.3 branch