[LTP] [PATCH v2 1/3] syscalls/ftruncate: Rewrite ftruncate01 and merge ftruncate02

Cyril Hrubis chrubis@suse.cz
Tue Aug 13 16:20:38 CEST 2019


Hi!
Pushed with a minor change, thanks.

> +	SAFE_FSTAT(fd, &stat_buf);
> +	file_length = stat_buf.st_size;
>  
> -	tst_sig(NOFORK, DEF_HANDLER, cleanup);
> +	if (file_length != trunc_len) {
> +		tst_brk(TBROK, "ftruncate() got incorrected size: %d",
> +			file_length);

Changed this to tst_res(TFAIL, ...) followed by return, since this is by
no means TBROK.

> +	}
>  
> -	TEST_PAUSE;
> +	SAFE_LSEEK(fd, offset, SEEK_SET);
> +	SAFE_READ(0, fd, buf, sizeof(buf));
>  
> -	tst_tmpdir();
> +	for (i = 0; i < TRUNC_LEN1; i++) {
> +		if (buf[i] != data)
> +			tst_brk(TBROK, "ftruncate() got incorrect data");

And here as well.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list