[PATCH] mini port scanner for busybox - V3
Tito
farmatito at tiscali.it
Thu Jun 14 19:50:18 UTC 2007
On Thursday 14 June 2007 21:00:41 Denis Vlasenko wrote:
> On Thursday 14 June 2007 16:41, Luciano Rocha wrote:
> > On Thu, Jun 14, 2007 at 04:12:20PM +0200, Tito wrote:
> > > +static int my_gettimeofday(void)
> > > +{
> > > + struct timeval now;
> > > +
> > > + if (gettimeofday(&now, NULL))
> > > + return 0;
> > > + return (now.tv_sec * 1000000 + now.tv_usec);
> >
> > Err, this overflows in current 32bits systems. tv_sec is already in the
> > 31 bit limit (1181831862).
> >
> > Use long long instead.
>
> But he uses these only for time diff (t2 - t1 style thing).
> It's ok then.
I think that the return value can overflow due to the now.tv_sec * 1000000 at least in theory
if tv.usec is big enough so i changed the return type to long long as Luciano said.
>
> Actually, my_gettimeofday looks like possible libbb addition.
> traceroute can use it already.
>
> The only problem is that gettimeofday will jump if time
> is reset. But it's not a new problem.
> --
> vda
Here is version 3 of the patch.
Ciao,
Tito
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pscan03.patch
Type: text/x-diff
Size: 6272 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070614/0d826f04/attachment-0002.bin
More information about the busybox
mailing list