[libvirt] [PATCH] Eliminate failure to delete empty storage pools
Daniel P. Berrange
berrange at redhat.com
Sat Dec 12 11:21:40 UTC 2009
On Sat, Dec 12, 2009 at 01:26:43AM -0500, Laine Stump wrote:
> virStorageBackendFileSystemDelete was incorrectly calling unlink() in
> an attempt to remove a directory. It should be calling rmdir()
> instead. (remove() would also work, but could potentially succeed on a
> non-empty pool if the pool was a symlink to somewhere else).
> ---
> src/storage/storage_backend_fs.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index 16e4bd9..b7d4bd6 100644
> --- a/src/storage/storage_backend_fs.c
> +++ b/src/storage/storage_backend_fs.c
> @@ -693,9 +693,9 @@ virStorageBackendFileSystemDelete(virConnectPtr conn,
> {
> /* XXX delete all vols first ? */
>
> - if (unlink(pool->def->target.path) < 0) {
> + if (rmdir(pool->def->target.path) < 0) {
> virReportSystemError(conn, errno,
> - _("cannot unlink path '%s'"),
> + _("failed to remove pool '%s'"),
> pool->def->target.path);
> return -1;
> }
ACK
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list