[LTP] [PATCH v8 2/2] fstat: add test for multiple file types using fstat

Andrea Cervesato andrea.cervesato@suse.com
Mon Jun 15 15:21:39 CEST 2026


Hi Jinseok,

> +	int flags = O_RDONLY | O_NONBLOCK;

consider using O_PATH instead of O_RDONLY | O_NONBLOCK for device
nodes. fstat() works correctly on O_PATH file descriptors and returns
the right st_mode, without needing the underlying driver to be
present. Please use it in the SAFE_OPEN().

> +
> +	if (tc->exp_type == S_IFDIR)
> +		flags |= O_DIRECTORY;
> +
> +	int fd = SAFE_OPEN(tc->path, flags);

The test does not gate on CONFIG_BLK_DEV_LOOP via .needs_kconfigs,
so SAFE_OPEN will TBROK on systems without loop support.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list