[systemd-devel] Native journald logging for Python
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Tue Jun 26 10:32:47 PDT 2012
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
More information about the systemd-devel
mailing list