[LTP] [PATCH] setdomainname: use strlen() to get length of string

Petr Vorel pvorel@suse.cz
Wed Jul 24 10:38:38 CEST 2019


Hi Li,

> On 2019/07/23 18:28, Li Wang wrote:
> > The sizeof(new) is only to get the size of char *, and it's not corret to pass
> > it as 'len' in setdomainname(). Here replace by strlen() to get the correct number
> > of characters for string.
> Hi Li,

> As setdomainname(2) manpage mentions, name does not require a terminating
> null byte.
> It looks good to me. :-)

> Best Regards,
> Xiao Yang
> > On x86_64, we get this failures if the LTP compilied in 32bit.

> >    -----Error Log-----
> >    setdomainname.h:24: INFO: Testing libc setdomainname()
> >    setdomainname01.c:24: FAIL: getdomainname() returned wrong domainname: 'test'
> >    setdomainname.h:27: INFO: Testing __NR_setdomainname syscall
> >    setdomainname01.c:24: FAIL: getdomainname() returned wrong domainname: 'test'
> >    -------------------

Thanks for fixing it and sorry for introducing obvious error.
Merged into master.

Kind regards,
Petr


More information about the ltp mailing list