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

Andrea Cervesato via ltp <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
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-IBi9RG/[email protected]

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.