[LTP] [PATCH 2/2] Use correct binary operand in ioctl02.c

Martin Doucha mdoucha@suse.cz
Wed Sep 6 17:53:23 CEST 2023


Hi,

On 05. 09. 23 13:56, Marius Kittler wrote:
> Signed-off-by: Marius Kittler <mkittler@suse.de>
> ---
>   testcases/kernel/syscalls/ioctl/ioctl02.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/ioctl/ioctl02.c b/testcases/kernel/syscalls/ioctl/ioctl02.c
> index 65a00821c..999128ed8 100644
> --- a/testcases/kernel/syscalls/ioctl/ioctl02.c
> +++ b/testcases/kernel/syscalls/ioctl/ioctl02.c
> @@ -282,7 +282,7 @@ static int chk_tty_parms(void)
>   
>   	if (!
>   	    (termio.c_lflag
> -	     && (ISIG | ICANON | XCASE | ECHO | ECHOE | NOFLSH))) {
> +	     & (ISIG | ICANON | XCASE | ECHO | ECHOE | NOFLSH))) {

The long list of flags looks suspiciously like the check should be != 
instead of &. And since it matches the flags passed to ioctl(TCSETA), 
it'd be better to use a different variable for ioctl(TCGETA) and compare 
the two variables instead of checking long hardcoded lists of flags.

>   		tst_res(TINFO, "lflag has incorrect value. %o",
>   			 termio.c_lflag);
>   		flag++;
> @@ -290,14 +290,14 @@ static int chk_tty_parms(void)
>   
>   	if (!
>   	    (termio.c_iflag
> -	     && (BRKINT | IGNPAR | INPCK | ISTRIP | ICRNL | IUCLC | IXON | IXANY
> +	     & (BRKINT | IGNPAR | INPCK | ISTRIP | ICRNL | IUCLC | IXON | IXANY
>   		 | IXOFF))) {
>   		tst_res(TINFO, "iflag has incorrect value. %o",
>   			 termio.c_iflag);
>   		flag++;
>   	}
>   
> -	if (!(termio.c_oflag && (OPOST | OLCUC | ONLCR | ONOCR))) {
> +	if (!(termio.c_oflag & (OPOST | OLCUC | ONLCR | ONOCR))) {
>   		tst_res(TINFO, "oflag has incorrect value. %o",
>   			 termio.c_oflag);
>   		flag++;

-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic



More information about the ltp mailing list