[LTP] [PATCH v2] syscalls: Fix tst_res() format string for 64-bit offset

Petr Vorel pvorel@suse.cz
Tue Sep 20 20:49:47 CEST 2022


Hi Randolph,

> When compiling format string contains off_t type, to print off_t
> correctly is cast it to (long long int) type and change the format
> string to %lli.
LGTM, I'd just use %lld instead of %lli (it's exactly the same, but %lld is IMHO
more common.

Kind regards,
Petr

...
> +++ b/testcases/kernel/syscalls/lseek/lseek11.c
> @@ -159,7 +159,7 @@ static void setup(void)
>  	fd = SAFE_OPEN(fname, O_RDWR | O_CREAT, 0666);

>  	get_blocksize();
> -	tst_res(TINFO, "The block size is %lu", block_size);
> +	tst_res(TINFO, "The block size is %d", block_size);
This is wrong. While blksize_t is on aarch64 and riscv64 int, on 
most archs is long, thus this needs to have the same approach as the rest
(%lld and (long long int) cast.

with these 2 changes:

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Kind regards,
Petr


More information about the ltp mailing list