[Midnightbsd-cvs] src [7497] trunk/usr.sbin/mport/mport.c: improve error handling and clean up

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Mar 20 23:12:47 EDT 2016


Revision: 7497
          http://svnweb.midnightbsd.org/src/?rev=7497
Author:   laffer1
Date:     2016-03-20 23:12:47 -0400 (Sun, 20 Mar 2016)
Log Message:
-----------
improve error handling and clean up

Modified Paths:
--------------
    trunk/usr.sbin/mport/mport.c

Modified: trunk/usr.sbin/mport/mport.c
===================================================================
--- trunk/usr.sbin/mport/mport.c	2016-03-21 03:02:20 UTC (rev 7496)
+++ trunk/usr.sbin/mport/mport.c	2016-03-21 03:12:47 UTC (rev 7497)
@@ -31,6 +31,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
+#include <sysexits.h>
 #include <unistd.h>
 #include <err.h>
 #include <mport.h>
@@ -205,7 +206,7 @@
 		});
 	} else if (!strcmp(argv[1], "cpe")) {
 		dispatch_group_async(grp, q, ^{
-		resultCode = cpeList(mport);
+			resultCode = cpeList(mport);
 		});
 	} else if (!strcmp(argv[1], "deleteall")) {
 		dispatch_group_async(grp, q, ^{
@@ -663,13 +664,12 @@
 		}
 		packs++;
 	}
+	mport_pkgmeta_vec_free(packs);
 
 	if (cpe_total == 0) {
-		puts("No packages contained CPE information.");
+		errx(EX_SOFTWARE, "No packages contained CPE information.");
 	}
 
-	mport_pkgmeta_vec_free(packs);
-
 	return (0);
 }
 



More information about the Midnightbsd-cvs mailing list