aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2023-07-21 14:22:27 +0100
committerJon Turney <jon.turney@dronecode.org.uk>2023-07-21 14:24:08 +0100
commit8b0b719d499f6025b56652d8282d5a52f3722dc4 (patch)
treeb0c1864538abc73c93cf213eb6fae36e356cb471 /winsup
parent42b44044b34d7c26abf84f8b24f820e04e1662f2 (diff)
downloadnewlib-8b0b719d499f6025b56652d8282d5a52f3722dc4.zip
newlib-8b0b719d499f6025b56652d8282d5a52f3722dc4.tar.gz
newlib-8b0b719d499f6025b56652d8282d5a52f3722dc4.tar.bz2
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: 42b44044b34d ("Cygwin: Fix Windows file handle leak in stat("file", -1)") Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/syscalls.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 32ace4d..f1cd569 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -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);