pm

barely a pack manager
git clone git://z3bra.org/pm
Log | Files | Refs | README | LICENSE

commit 719fc796cedbdd1b2db385d7a6235370d2d21abc
parent db07b233b50ef3e66363489c8f85cd189525a579
Author: z3bra <willyatmailoodotorg>
Date:   Fri Dec 16 02:27:06 +0100

Exit if REPO_EXEC fails to run

Diffstat:
pm.c | 10++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/pm.c b/pm.c @@ -9,6 +9,7 @@ #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> +#include <sys/wait.h> #include <archive.h> #include <archive_entry.h> @@ -797,7 +798,7 @@ install(const char *rootfs, const char *datadir, char *name) int pack_find(char *name, char *out) { - int fd[2]; + int fd[2], status; size_t len = 0; pipe(fd); @@ -808,9 +809,14 @@ pack_find(char *name, char *out) execlp(REPO_EXEC, REPO_EXEC, name, NULL); } + close(fd[1]); + + wait(&status); + if (status) + exit(1); + len = read(fd[0], out, PATH_MAX); close(fd[0]); - close(fd[1]); if (len < 1) return -1;