package

simple and robust package manager
Log | Files | Refs | README

commit 062322e033a54c85e362d4d91e27cc1a71d60656
parent 14ed8c644a93e69181a0cbf58633b4ac81bf4f82
Author: Josuah Demangeon <mail@josuah.net>
Date:   Sun, 13 Jan 2019 01:27:17 +0100

pack_env: fix error handling

Diffstat:
Mbin/pack-git | 7+++----
Mpack.c | 4++--
2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/bin/pack-git b/bin/pack-git @@ -1,9 +1,8 @@ #!/bin/sh -e PACK=${PACK:-/var/pack} pack=${1%/*} -version=${1#*/} -uri=$2 +url=$2 mkdir -p "$PACK/git/$pack" "$PACK/tar/$pack" -git clone --bare "$url" "$PACK/git/$pack/$version" -git -C "$PACK/git/$pack/$version" archive master >$PACK/tar/$pack/$version.tar +! git clone --bare "$url" "$PACK/git/$1" +git -C "$PACK/git/$1" archive --format=tar master >$PACK/tar/$1.tar diff --git a/pack.c b/pack.c @@ -420,11 +420,11 @@ pack_env(pack *p, const char *def, const char *out) if (!stralloc_cats(&path, "/")) goto err; if (!stralloc_cats(&path, p->ver)) goto err; if (!stralloc_0(&path)) goto err; - pack_envset("PREFIX", path.x); + if (!pack_envset("PREFIX", path.x)) goto err; errno = 0; fd = pack_opendepfile(p, def); - if (fd == -1) return (errno == ENOTDIR || errno == ENOENT); + if (fd == -1) { ret = (errno != ENOTDIR && errno != ENOENT); goto err; } buffer_init(&b, &read, fd, buf, sizeof buf); stralloc_init(&line);