On Wed, Apr 10, 2013 at 11:25:10AM -0600, Eric Blake wrote:
On 04/10/2013 04:08 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange@redhat.com>
Introduce a method virFileDeleteTree for recursively deleting an entire directory tree
Signed-off-by: Daniel P. Berrange <berrange@redhat.com> --- + +/** + * virFileDeleteTree: + * + * Recursively deletes all files / directories + * starting from the directory @dir. Does not + * follow symlinks
I would add a comment mentioning that this function is not efficient to use on arbitrarily large or deep hierarchies. But I agree with Michal's ACK.
I added: @@ -652,6 +652,11 @@ int virFileLoopDeviceAssociate(const char *file, * Recursively deletes all files / directories * starting from the directory @dir. Does not * follow symlinks + * + * NB the algorithm is not efficient, and is subject to + * race conditions which can be exploited by malicious + * code. It should not be used in any scenarios where + * performance is important, or security is critical. */ Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|