]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
storage: treat return value from ops->destroy as int 2097/head
authorMichael McCracken <mikmccra@cisco.com>
Fri, 19 Jan 2018 16:38:36 +0000 (08:38 -0800)
committerMichael McCracken <mikmccra@cisco.com>
Fri, 19 Jan 2018 16:44:04 +0000 (08:44 -0800)
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 <mikmccra@cisco.com>
src/lxc/storage/storage.c

index 98aa031b7f7cad3f4d4063f726045ac99a35d780..e080ad87ad4a52e417bafa9ce0e2948a001ceb2e 100644 (file)
@@ -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);