[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [PATCH] Replace File::Path's remove_tree

On 26/01/11 17:16, Richard W.M. Jones wrote:
On Wed, Jan 26, 2011 at 05:05:42PM +0000, Matthew Booth wrote:
We were using remove_tree in the RHEV cleanup code. remove_tree seems to use
chdir. Unfortunately, as this code will be running seteuid(36), it is not
unlikely that the current working directory will not be readable. This causes
remove_tree to fail.

This patch replaces remove_tree with a simple recursive remove, obviously
without using chdir.

Recursive removes like this are full of potential fail.

I'd prefer it if you did:

   system ('rm', '-rf', $path);

But that wouldn't be nearly as much code, and what if 'rm' wasn't available on the system....

Patch to follow ;)

Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]