[systemd-devel] Native journald logging for Python

David Strauss david at getpantheon.com
Tue Jun 26 10:36:48 PDT 2012


I'll figure it out. :-)
On Jun 26, 2012 10:32 AM, "Zbigniew Jędrzejewski-Szmek" <zbyszek at in.waw.pl>
wrote:

> On 06/26/2012 05:31 PM, Zbigniew Jędrzejewski-Szmek wrote:
> > PyObject *item = PyTuple_GetItem(args, i);
> > char * stritem = PyString_AsString(item);
> > iov[i].iov_base = stritem;
> > iov[i].iov_len = strlen(stritem);
> >
> > I think that there's a problem here -- PyString_AsString will return
> > NULL if item is not a string. Also, using PyString_AsStringAndSize would
> > avoid the need to iterate over the memory with strlen.
> >
> > So maybe something like:
> >
> > if(PyString_AsStringAndSize(item, &iov[i].iov_base, &iov[i].iov_len))
> >   return NULL;
> Ooops. This would lose iov of course.
>
> Zbyszek
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20120626/1b371e4e/attachment.html>


More information about the systemd-devel mailing list