The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2097

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
r->ops->destroy() returns an int, -1 on error.
When assigned to a bool, this becomes true and hides errors.

ret will always be true - on error, it's -1 - a true bool - or it is zero and thus set to true.

Signed-off-by: Michael McCracken <mikmc...@cisco.com>
From ed05aac829498161289d4f2da4002b42fb54bc32 Mon Sep 17 00:00:00 2001
From: Michael McCracken <mikmc...@cisco.com>
Date: Fri, 19 Jan 2018 08:38:36 -0800
Subject: [PATCH] storage: treat return value from ops->destroy as int

r->ops->destroy() returns an int, -1 on error.
When assigned to a bool, this becomes true and hides errors.

Signed-off-by: Michael McCracken <mikmc...@cisco.com>
---
 src/lxc/storage/storage.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/lxc/storage/storage.c b/src/lxc/storage/storage.c
index 98aa031b7..e080ad87a 100644
--- a/src/lxc/storage/storage.c
+++ b/src/lxc/storage/storage.c
@@ -603,13 +603,14 @@ bool storage_destroy(struct lxc_conf *conf)
 {
        struct lxc_storage *r;
        bool ret = false;
+       int destroy_rv = 0;
 
        r = storage_init(conf);
        if (!r)
                return ret;
 
-       ret = r->ops->destroy(r);
-       if (ret == 0)
+       destroy_rv = r->ops->destroy(r);
+       if (destroy_rv == 0)
                ret = true;
 
        storage_put(r);
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to