diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-05-22 15:24:08 +0100 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2016-07-01 22:37:38 +0100 |
commit | 6b6d2e426e5ee6b08c706d57db7502d80e00e82b (patch) | |
tree | e82e40517d2eb6bd8ea16c62cb780336c7d38094 /dgit | |
parent | 9810537db1cd42febc3283a69fa6c09b5b212f30 (diff) |
When cleaning up after failed clone, stat the to-be-cleaned-up directory before running rmtree on it. Closes:#796773.
Diffstat (limited to 'dgit')
-rwxr-xr-x | dgit | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -2131,7 +2131,13 @@ sub cmd_clone { return if $!==&ENOENT; die "chdir $cwd_remove: $!"; } - rmtree($dstdir) or die "remove $dstdir: $!\n"; + if (stat $dstdir) { + rmtree($dstdir) or die "remove $dstdir: $!\n"; + } elsif (!grep { $! == $_ } + (ENOENT, ENOTDIR, EACCES, EPERM, ELOOP)) { + } else { + print STDERR "check whether to remove $dstdir: $!\n"; + } }; } |