On Wed, Jun 22, 2016 at 08:12:16PM -0400, Cole Robinson wrote:
The various object implementations for configFile unlinking have subtly different error handling behavior. Sync the impls to use a single error string, and consistently ignore ENOENT, to allow undefining an object whose configFile was deleted behind libvirt's back --- src/conf/domain_conf.c | 7 ++----- src/conf/network_conf.c | 6 ++---- src/conf/nwfilter_conf.c | 6 ++---- src/conf/storage_conf.c | 7 +++---- src/conf/virsecretobj.c | 2 +- 5 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 75ad03f..9e5af3f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -23881,11 +23881,8 @@ virDomainDeleteConfig(const char *configDir, unlink(autostartLink); dom->autostart = 0; - if (unlink(configFile) < 0 && - errno != ENOENT) { - virReportSystemError(errno, - _("cannot remove config %s"), - configFile); + if (unlink(configFile) < 0 && errno != ENOENT) { + virReportSystemError(errno, _("cannot remove config %s"), configFile); goto cleanup;
Using a helper function that ignores errno and only calls virReportSystemError from one place would be even more consistent. Jan -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list