[liboping] Odd bug in Net::Oping 1.20 in combination with liboping-1.3.3

Florian Forster octo at verplant.org
Thu Oct 1 14:26:29 CEST 2009


Hi Fredrik,

On Thu, Oct 01, 2009 at 01:06:01PM +0200, Fredrik Soderblom wrote:
> Took me a while to figure out, but i found a rather odd bug
> manifesting in Net::Oping (see attached file), but the net effect is
> that you can't access the latency time w/o  prepending a NULL
> character to the hostname when dealing w. the hash reference being
> returned by $obj->ping ().

oh, yeah. The problem is that “ping_iterator_get_info” returns a buffer
size (i. e. includes the trailing null byte in the size) but Perl's
“newSVpvn” required the string length (i. e. not including the null
byte).

On Thu, Oct 01, 2009 at 01:18:50PM +0200, Fredrik Soderblom wrote:
> However, you have most likely a very good reason for using newSVpvn()
> instead of newSVpv(), so im prolly just lost :P

Yeah, using “newSVpv” is possible, too. I dislike such magic as “do
something different if the second arguemt is some special value”, so
I've changed the line to:

  XPUSHs (sv_2mortal (newSVpvn(buffer, strlen (buffer))));

(Still enough magic in that. Plus it looks a bit like Lisp. ;)

Thanks for the pointer and your fix, I'll upload an updated version of
Net::Oping soon :)

Regards,
—octo
-- 
Florian octo Forster
Hacker in training
GnuPG: 0x91523C3D
http://verplant.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/liboping/attachments/20091001/cbbba108/attachment.pgp 


More information about the liboping mailing list