From d9b46a0d0462e41691d9b132338c0f2ae38c152d Mon Sep 17 00:00:00 2001 From: Mark Wu Date: Fri, 22 Apr 2011 11:45:33 +0200 Subject: [PATCH] Make crash and live flags mutually exclusive in virDomainCoreDump They don't make any sense when used together. --- AUTHORS | 1 + src/libvirt.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index d530e0474f..10124ee5cf 100644 --- a/AUTHORS +++ b/AUTHORS @@ -167,6 +167,7 @@ Patches have also been contributed by: Jesse Cook Alexander Todorov Richard Laager + Mark Wu [....send patches to get your name here....] diff --git a/src/libvirt.c b/src/libvirt.c index 10c3cdf42f..e74e9774ef 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -2347,7 +2347,7 @@ error: * virDomainCoreDump: * @domain: a domain object * @to: path for the core file - * @flags: extra flags, currently unused + * @flags: an OR'ed set of virDomainCoreDumpFlags * * This method will dump the core of a domain on a given file for analysis. * Note that for remote Xen Daemon the file path will be interpreted in @@ -2379,6 +2379,12 @@ virDomainCoreDump(virDomainPtr domain, const char *to, int flags) goto error; } + if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_LIVE)) { + virLibDomainError(VIR_ERR_INVALID_ARG, + _("crash and live flags are mutually exclusive")); + goto error; + } + if (conn->driver->domainCoreDump) { int ret; char *absolute_to; -- 2.47.2