On Wed, Jun 22, 2016 at 12:18:38PM +0000, Fabien Siron wrote:
> Quoting Dmitry V. Levin (2016-06-22 11:13:42)
> > On Wed, Jun 22, 2016 at 10:19:03AM +0000, Fabien Siron wrote:
> > > Quoting Dmitry V. Levin (2016-06-21 17:43:49)
> > > > On Tue, Jun 21, 2016 at 02:42:46PM +0000, Fabien Siron wrote:
> [...]
> > > > > + if (nlmsghdr.nlmsg_len != (unsigned) -1 &&
> > > > > + nlmsghdr.nlmsg_len != 0 &&
> > > > > + NLMSG_ALIGN(nlmsghdr.nlmsg_len) < total_size) {
> > > > > + tprints("]");
> > > > > + }
> > > > > +}
> > > >
> > > > This check doesn't look obvious; is it correct?
> > > > Is there a more clear way to implement this?
> > >
> > > If nlmsghdr.nlmsg_len is equal to -1, it means that umoven had failed.
> >
> > No.
> >
> > > If nlmsghdr.nlmsg_len is equal to 0, it means that nlmsg_fetch had failed.
> > > I am not 100% sure of the last test but it seems that it's a correct way
> > > to
> > > detect if there were several messages.
> > >
> > > Have you got another idea to do this test?
> >
> > Just set a flag if "[" has been printed, and test it afterwards.
> >
> > Also, nlmsg_fetch returns 0 when nlmsghdr->nlmsg_len doesn't look sane.
> > Shouldn't strace print something meaningful in tis case, rather than
> > silently ignore invalid nlmsghdr?
>
> It already prints a string if the data is longer than 0 (instead of printing
> the header), does strace have to print something else?Only if len < sizeof(struct nlmsghdr). When len < nlmsghdr->nlmsg_len, it silently returns 0. I think that if struct nlmsghdr has been successfully fetched, the header should be printed regardless of its nlmsg_len. -- ldv
pgpKEogEZGhw0.pgp
Description: PGP signature
------------------------------------------------------------------------------ Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape
_______________________________________________ Strace-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/strace-devel
