linux: init st_flags and st_gen when using statx

Explicitly initialize uv_stat_t fields st_flags and st_gen when using
statx as uv__to_stat does when statx is not available. This makes
valgrind happier.

PR-URL: https://github.com/libuv/libuv/pull/2263
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jameson Nash <vtjnash@gmail.com>
This commit is contained in:
Oscar Waddell 2019-04-23 11:26:47 +02:00 committed by Ben Noordhuis
parent 03e389eb43
commit 1c2dc9c8d1
2 changed files with 5 additions and 0 deletions

View File

@ -1165,6 +1165,8 @@ static int uv__fs_statx(int fd,
buf->st_ctim.tv_nsec = statxbuf.stx_ctime.tv_nsec;
buf->st_birthtim.tv_sec = statxbuf.stx_btime.tv_sec;
buf->st_birthtim.tv_nsec = statxbuf.stx_btime.tv_nsec;
buf->st_flags = 0;
buf->st_gen = 0;
return 0;
#else

View File

@ -1171,6 +1171,7 @@ TEST_IMPL(fs_fstat) {
ASSERT(req.result == sizeof(test_buf));
uv_fs_req_cleanup(&req);
memset(&req.statbuf, 0xaa, sizeof(req.statbuf));
r = uv_fs_fstat(NULL, &req, file, NULL);
ASSERT(r == 0);
ASSERT(req.result == 0);
@ -1257,6 +1258,8 @@ TEST_IMPL(fs_fstat) {
s->st_birthtim.tv_sec == t.st_ctim.tv_sec);
ASSERT(s->st_birthtim.tv_nsec == 0 ||
s->st_birthtim.tv_nsec == t.st_ctim.tv_nsec);
ASSERT(s->st_flags == 0);
ASSERT(s->st_gen == 0);
#endif
uv_fs_req_cleanup(&req);