[packagekit] crasher fix

Ray Strode halfline at gmail.com
Sun Nov 4 12:24:16 PST 2007


Hey guys,

So I decided to try the PackageKit built in the Fedora 9 branch today
and ran into a problem where it would crash at this code:

        va_list args;
        gchar *arguments;

        /* get the argument list */
        va_start (args, script);
        arguments = g_strjoinv (" ", (gchar **)(void *)args);
        va_end (args);

I think you probably want something more like this (although I haven't
had a chance to test it yet and i'm getting pulled out the door):

+       GPtrArray *array;

+       array = g_ptr_array_new ();
+       g_ptr_array_add (array, script);
        /* get the argument list */
        va_start (args, script);
-       arguments = g_strjoinv (" ", (gchar **)(void *)args);
+       g_ptr_array_add (array, va_arg (args, char *));
        va_end (args);

+       arguments = g_strjoinv (" ", (char **) array->pdata);
+       g_ptr_array_free (array, FALSE);
+

--Ray
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PackageKit-0.1.2-stdargs-to-strarray.patch
Type: application/octet-stream
Size: 652 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/packagekit/attachments/20071104/a4d02473/attachment-0004.obj>


More information about the PackageKit mailing list