unix: fix uv_fs_stat when using statx

Specifically when filling the `st_rdev` field.

Fixes: https://github.com/libuv/libuv/issues/3051
PR-URL: https://github.com/libuv/libuv/pull/3052
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Simon Kadisch 2020-11-21 15:42:17 +01:00 committed by Santiago Gimeno
parent 263516e0a0
commit d3f042817d
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -58,6 +58,7 @@
#if defined(__linux__) || defined(__sun)
# include <sys/sendfile.h>
# include <sys/sysmacros.h>
#endif
#if defined(__APPLE__)
@ -1444,12 +1445,12 @@ static int uv__fs_statx(int fd,
return UV_ENOSYS;
}
buf->st_dev = 256 * statxbuf.stx_dev_major + statxbuf.stx_dev_minor;
buf->st_dev = makedev(statxbuf.stx_dev_major, statxbuf.stx_dev_minor);
buf->st_mode = statxbuf.stx_mode;
buf->st_nlink = statxbuf.stx_nlink;
buf->st_uid = statxbuf.stx_uid;
buf->st_gid = statxbuf.stx_gid;
buf->st_rdev = statxbuf.stx_rdev_major;
buf->st_rdev = makedev(statxbuf.stx_rdev_major, statxbuf.stx_rdev_minor);
buf->st_ino = statxbuf.stx_ino;
buf->st_size = statxbuf.stx_size;
buf->st_blksize = statxbuf.stx_blksize;