Cygwin: Fix uninitialized use of fh in strace output in stat_worker()

Move strace output to fix uninitalized use of fh introduced in previous commit.

../../../../src/winsup/cygwin/syscalls.cc: In function ‘int stat_worker(path_conv&, stat*)’:
../../../../src/winsup/cygwin/syscalls.cc:1971:69: error: ‘fh’ may be used uninitialized [-Werror=maybe-uninitialized]

Fixes: 42b44044b3 ("Cygwin: Fix Windows file handle leak in stat("file", -1)")
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This commit is contained in:
Jon Turney 2023-07-21 14:22:27 +01:00
parent 42b44044b3
commit 8b0b719d49
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
1 changed files with 3 additions and 2 deletions

View File

@ -1967,13 +1967,14 @@ stat_worker (path_conv &pc, struct stat *buf)
{
fhandler_base *fh;
debug_printf ("(%S, %p, %p), file_attributes %d",
pc.get_nt_native_path (), buf, fh, (DWORD) *fh);
memset (buf, 0, sizeof (*buf));
if (!(fh = build_fh_pc (pc)))
__leave;
debug_printf ("(%S, %p, %p), file_attributes %d",
pc.get_nt_native_path (), buf, fh, (DWORD) *fh);
res = fh->fstat (buf);
if (!res)
fh->stat_fixup (buf);