forked from ariadne/pkgconf
pkg: fix pkg_t.id initialization
parent
79ca134f7f
commit
573cf8d21c
7
pkg.c
7
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;
|
||||
|
|
Loading…
Reference in New Issue