pm

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

commit 247e62ef65fa6934b4952002822c4ec5085cb286
parent 84b7654d682411377a6469d7bb79a4aca45a4039
Author: z3bra <willyatmailoodotorg>
Date:   Wed Dec 23 19:25:10 2015

Change directory after opening package

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

diff --git a/pm.c b/pm.c @@ -184,12 +184,6 @@ unpack(char *root, const char *in) |ARCHIVE_EXTRACT_NO_OVERWRITE |ARCHIVE_EXTRACT_SECURE_NODOTDOT; - /* extract the package at the specified root */ - if (chdir(root) < 0) { - perror("chdir"); - return -1; - } - a = archive_read_new(); archive_read_support_filter_all(a); archive_read_support_format_all(a); @@ -202,6 +196,12 @@ unpack(char *root, const char *in) if (r != ARCHIVE_OK) return r; + /* extract the package at the specified root */ + if (chdir(root) < 0) { + perror("chdir"); + return -1; + } + while (archive_read_next_header(a, &e) != ARCHIVE_EOF) { r = archive_write_header(w, e);