pm

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

commit 4cddf9af68b6e22c51621a9c04159a266f23adc5
parent 1e9efd313217ed16e878585b1b9bb927e3dd9f79
Author: z3bra <willyatmailoodotorg>
Date:   Wed Dec 30 12:11:16 2015

Check path before loading package

Diffstat:
 pm.c | 8 ++++++++
 1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/pm.c b/pm.c @@ -277,10 +277,18 @@ unpack(char *root, char *in) struct pkg * pack_load_file(char *path) { + int fd; struct pkg *pack = malloc(sizeof(struct pkg)); char tmp[PATH_MAX]; char *p; + if ((fd = open(path, O_RDONLY)) < 0) { + perror("open"); + free(pack); + return NULL; + } + close(fd); + pack->path = strdup(path); snprintf(tmp, PATH_MAX, "%s", base_name(path));