lib:mscat: Add missing return check for error in dumpsmcat
authorAndreas Schneider <asn@samba.org>
Mon, 20 May 2019 13:57:45 +0000 (15:57 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 24 May 2019 06:07:08 +0000 (06:07 +0000)
Found by csbuild.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Gary Lockyer <gary@samba.org>
lib/mscat/dumpmscat.c

index eac2184e7ad15d3909cc5c4b4a5a45edb0f89bff..5364610d48313067c757f49df83e37f68ed6f4ce 100644 (file)
@@ -103,11 +103,16 @@ int main(int argc, char *argv[]) {
        }
 
        rc = mscat_ctl_import(msctl, cat_pkcs7);
-       if (rc != 0) {
+       if (rc < 0) {
+               exit(1);
+       }
+
+       rc = mscat_ctl_get_member_count(msctl);
+       if (rc < 0) {
                exit(1);
        }
 
-       member_count = mscat_ctl_get_member_count(msctl);
+       member_count = rc;
        printf("CATALOG MEMBER COUNT=%d\n", member_count);
 
        for (i = 0; i < member_count; i++) {
@@ -164,7 +169,11 @@ int main(int argc, char *argv[]) {
        }
        printf("\n");
 
-       attribute_count = mscat_ctl_get_attribute_count(msctl);
+       rc = mscat_ctl_get_attribute_count(msctl);
+       if (rc < 0) {
+               exit(1);
+       }
+       attribute_count = rc;
        printf("CATALOG ATTRIBUTE COUNT=%d\n", attribute_count);
 
        for (i = 0; i < attribute_count; i++) {