]> sourceware.org Git - lvm2.git/commitdiff
Update test/api/*.c to use consistent liblvm error returns.
authorDave Wysochanski <dwysocha@redhat.com>
Sun, 26 Jul 2009 20:29:56 +0000 (20:29 +0000)
committerDave Wysochanski <dwysocha@redhat.com>
Sun, 26 Jul 2009 20:29:56 +0000 (20:29 +0000)
For now, liblvm will return -1 (fail) / 0 (success) or
NULL (fail) / non-NULL (success).  Upon failure, lvm_errno and
lvm_errmsg should be used to determine the precise error.

Author: Dave Wysochanski <dwysocha@redhat.com>

test/api/test.c
test/api/vgtest.c

index 289278deedec14f9e2890c4c951c9f20cf1d84e9..a8881183feedffb8c3d482fffdaa50213d7a1968 100644 (file)
@@ -327,7 +327,7 @@ static void _vg_remove_lv(char **argv, int argc)
        }
        if (!(lv = _lookup_lv_by_name(argv[2])))
                return;
-       if (!lvm_vg_remove_lv(lv))
+       if (lvm_vg_remove_lv(lv))
                printf("Error ");
        else {
                printf("Success ");
index f6ede32fb7254bfe5e503816e9e6d491006abf9e..4ab9a46e89561a1b5ce9a22b385f1570dff26bc9 100644 (file)
@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
 
        printf("Extending VG %s\n", vg_name);
        status = lvm_vg_extend(vg, device);
-       if (!status) {
+       if (status) {
                fprintf(stderr, "Error extending volume group %s "
                        "with device %s\n", vg_name, device);
                goto bad;
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
 
        printf("Setting VG %s extent_size to %"PRIu64"\n", vg_name, size);
        status = lvm_vg_set_extent_size(vg, size);
-       if (!status) {
+       if (status) {
                fprintf(stderr, "Can not set physical extent "
                        "size '%"PRIu64"' for '%s'\n",
                        size, vg_name);
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
 
        printf("Committing VG %s to disk\n", vg_name);
        status = lvm_vg_write(vg);
-       if (!status) {
+       if (status) {
                fprintf(stderr, "Creation of volume group '%s' on "
                        "device '%s' failed\n",
                        vg_name, device);
@@ -75,14 +75,14 @@ int main(int argc, char *argv[])
        }
 
        printf("Closing VG %s\n", vg_name);
-       if (!lvm_vg_close(vg))
+       if (lvm_vg_close(vg))
                goto bad;
        printf("Re-opening VG %s for reading\n", vg_name);
        vg = lvm_vg_open(handle, vg_name, "r", 0);
        if (!vg)
                goto bad;
        printf("Closing VG %s\n", vg_name);
-       if (!lvm_vg_close(vg))
+       if (lvm_vg_close(vg))
                goto bad;
        printf("Re-opening VG %s for writing\n", vg_name);
        vg = lvm_vg_open(handle, vg_name, "w", 0);
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
                goto bad;
        printf("Removing VG %s from system\n", vg_name);
        status = lvm_vg_remove(vg);
-       if (lvm_errno(handle)) {
+       if (status) {
                fprintf(stderr, "Revmoval of volume group '%s' failed\n",
                        vg_name);
                goto bad;
This page took 0.042168 seconds and 5 git commands to generate.