]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
src: don't hide error in VIR_DRV_SUPPORTS_FEATURE
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Fri, 18 Dec 2020 06:40:04 +0000 (09:40 +0300)
committerNick Shyrokovskiy <nshyrokovskiy@gmail.com>
Wed, 6 Jan 2021 14:10:10 +0000 (17:10 +0300)
Otherwise we can get misleading error messages. One example is when connection
is broken we got "this function is not supported by the connection driver:
virDomainMigrate3" from virDomainMigrate3.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/driver.h

index 6278aa05b3a8838741296706c9ef233e43655781..2531ac3382b024b3b1fc89bff59360aa0fed7c45 100644 (file)
@@ -47,17 +47,14 @@ typedef enum {
  * directly if you don't have to, because it may be NULL, use this macro
  * instead.
  *
- * Note that this treats a possible error returned by drv->supports_feature
- * the same as not supported. If you care about the error, call
- * drv->supports_feature directly.
- *
  * Returns:
- *   != 0  Feature is supported.
+ *   -1    Error
+ *   >0    Feature is supported.
  *   0     Feature is not supported.
  */
 #define VIR_DRV_SUPPORTS_FEATURE(drv, conn, feature) \
     ((drv)->connectSupportsFeature ? \
-        (drv)->connectSupportsFeature((conn), (feature)) > 0 : 0)
+        (drv)->connectSupportsFeature((conn), (feature)) : 0)
 
 
 #define __VIR_DRIVER_H_INCLUDES___