pkg: fix pkg_t.id initialization

feature/tap-sh
William Pitcock 2012-07-26 00:12:29 -05:00
parent 79ca134f7f
commit 573cf8d21c
1 changed files with 7 additions and 0 deletions

7
pkg.c
View File

@ -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;