I am working on pulling some rpm info out of a headerEntry but, I am
running into trouble with RPMTAG_PROVIDEFLAGS. The snippet below shows
how I am pulling out the provides and sticking it in a struct called
pkg_node_exp. (The printf statements show that the flags are being
pulled out correctly.)
headerGetEntry (hd, RPMTAG_PROVIDENAME, &type, (void **) &arg, &count);
pkg_node_exp->provide_name = (char **) arg;
headerGetEntry (hd, RPMTAG_PROVIDEFLAGS, &type, (void **) &flags,
&count);
pkg_node_exp->provide_flags = (int_32 *)flags;
printf ("\t count = %d\n", count);
printf ("\t %d\n", pkg_node_exp->provide_flags[0]);
printf ("\t %d\n", pkg_node_exp->provide_flags[1]);
headerGetEntry (hd, RPMTAG_PROVIDEVERSION, &type, (void **) &arg,
&count);
pkg_node_exp->provide_version = (char **) arg;
pkg_node_exp->provide_count = count;
Later when I try to use pkg_node_exp via
if (pkg_node_exp->provide_count > 0)
{
printf ("Provides\n");
printf ("\t count = %d\n", pkg_node_exp->provide_count);
for (i = 0; i < pkg_node_exp->provide_count; i++)
printf ("\t %s %i %s\n",
pkg_node_exp->provide_name[i],
pkg_node_exp->provide_flags[i],
pkg_node_exp->provide_version[i]);
}
I get a segfault when when printing the provide_flags, if I comment the
line out the "pkg_node_exp->provide_flags[i]," line, the names and
versions are printed correctly. Are arrays of type int_32 being malloced
differently the arrays of char*s.
Thanks
-dtf
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list