From 573cf8d21ca7f3352e4603c8ca429d27cb4a3c71 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Thu, 26 Jul 2012 00:12:29 -0500 Subject: [PATCH] pkg: fix pkg_t.id initialization --- pkg.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg.c b/pkg.c index b5498e8..5cf1284 100644 --- a/pkg.c +++ b/pkg.c @@ -142,11 +142,18 @@ pkg_new_from_file(const char *filename, FILE *f) { pkg_t *pkg; char readbuf[PKG_BUFSIZE]; + char *idptr; pkg = calloc(sizeof(pkg_t), 1); pkg->filename = strdup(filename); pkg->vars = pkg_tuple_add(pkg->vars, "pcfiledir", pkg_get_parent_dir(pkg)); + /* make module id */ + pkg->id = strdup(basename(pkg->filename)); + idptr = strrchr(pkg->id, '.'); + if (idptr) + *idptr = '\0'; + while (pkg_fgetline(readbuf, PKG_BUFSIZE, f) != NULL) { char op, *p, *key = NULL, *value = NULL;