[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: rpmInstall()



On Mon, Jan 20, 2003 at 05:03:01PM -0500, Adam H. Pendleton wrote:
> 
> On Monday, January 20, 2003, at 11:35 AM, Jeff Johnson wrote:
> 
> > Yup. Since a pointer to a python object also traverses these
> > code paths it's impossible to do xstrdup() on the file path.
> 
> So if a strdup() of the package name won't work, then what is the 
> proper solution for "keeping the pointer valid"?  Would I need to have 
> a different (char *) pointer to *each* package in the transaction set?

Simplest is to do
...
	 rc = rpmtsAddInstallElement(ts, eiu->h, (fnpyKey)xstrdup(fileName),
                        (ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,
                        relocations);
...

Note: "(fnpyKey)xstrdup(fileName)".

There's a teensy memory leak ... <shrug>

73 de Jeff

-- 
Jeff Johnson	ARS N3NPQ
jbj@redhat.com (jbj@jbj.org)
Chapel Hill, NC





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []