stat-util: struct stat could be initialized with (st_mode & S_IFMT == 0)
authorMike Yuan <me@yhndnzj.com>
Mon, 11 Mar 2024 10:27:50 +0000 (18:27 +0800)
committerMike Yuan <me@yhndnzj.com>
Mon, 11 Mar 2024 14:57:50 +0000 (22:57 +0800)
commit945a8210c770801c8492eda03b6e9af3ec5d03a3
tree934461cec30ab2e974ec6860f828ecbb50708f93
parent0cdb8df6202e1b18d219c7fd0d74dd262231de78
stat-util: struct stat could be initialized with (st_mode & S_IFMT == 0)

For anonymous inodes, the result would be 0, but
the struct stat is initialized obviously.
So let's switch to st_dev for the check, which
is guaranteed to be non-zero.

Also this is completely unnecessary for statx(),
since we check stx_mask first and that on its own
denotes that the struct is initialized.
src/basic/stat-util.c