From abe3e5d11ba25da8c25f8bf517ee368b8e7ade9e Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Sat, 17 Sep 2016 02:03:42 -0500 Subject: [PATCH 1/1] improve error handling in zpm-addfile --- zpm-addfile.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zpm-addfile.c b/zpm-addfile.c index 961b6b8..480c38a 100644 --- a/zpm-addfile.c +++ b/zpm-addfile.c @@ -1,3 +1,4 @@ +#include #include #include "zpm.h" @@ -11,10 +12,13 @@ int main(int ac, char **av){ } zpm_open(&pkg, av[1]); zpm_begin(&pkg); - zpm_import(&pkg, av[2], 0, hash); - zpm_commit(&pkg); + if (zpm_import(&pkg, av[2], 0, hash)) { + zpm_commit(&pkg); + fprintf(stdout, "%s\n", hash); + //fprintf(stdout, "%s %s\n", hash, av[2]); + } else { + exit(1); + } zpm_close(&pkg); - //fprintf(stdout, "%s %s\n", hash, av[2]); - fprintf(stdout, "%s\n", hash); return 0; } -- 2.40.0