pkgtools

morpheus pkg tools
git clone git://git.2f30.org/pkgtools.git
Log | Files | Refs | README | LICENSE

commit 223cf874fde68ff2505adbb512c22b8401ad3682
parent 351db194850d21e447cfa7574417e19df838fd63
Author: sin <sin@2f30.org>
Date:   Tue Jun 24 16:17:12 +0100

Strip leading ./ before installing

Diffstat:
pkg.c | 15+++++++++++----
reject.c | 4----
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/pkg.c b/pkg.c @@ -73,6 +73,7 @@ struct pkg * pkg_load_file(struct db *db, const char *file) { char path[PATH_MAX]; + const char *tmp; char *name, *version; struct pkg *pkg; struct pkgentry *pe; @@ -115,14 +116,20 @@ pkg_load_file(struct db *db, const char *file) pkg_free(pkg); return NULL; } + + tmp = archive_entry_pathname(entry); + if (strncmp(tmp, "./", 2) == 0) + tmp += 2; + + if (tmp[0] == '\0') + continue; + pe = emalloc(sizeof(*pe)); estrlcpy(path, db->prefix, sizeof(path)); estrlcat(path, "/", sizeof(path)); - estrlcat(path, archive_entry_pathname(entry), - sizeof(path)); + estrlcat(path, tmp, sizeof(path)); estrlcpy(pe->path, path, sizeof(pe->path)); - estrlcpy(pe->rpath, archive_entry_pathname(entry), - sizeof(pe->rpath)); + estrlcpy(pe->rpath, tmp, sizeof(pe->rpath)); TAILQ_INSERT_TAIL(&pkg->pe_head, pe, entry); } diff --git a/reject.c b/reject.c @@ -71,10 +71,6 @@ rej_match(struct db *db, const char *file) { struct rejrule *rule; - /* Skip initial '.' of "./" */ - if (strncmp(file, "./", 2) == 0) - file++; - TAILQ_FOREACH(rule, &db->rejrule_head, entry) if (regexec(&rule->preg, file, 0, NULL, 0) != REG_NOMATCH) return 1;