public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: Fix uninitialized use of fh in strace output in stat_worker()
@ 2023-07-21 13:34 Jon Turney
  0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2023-07-21 13:34 UTC (permalink / raw)
  To: cygwin-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8b0b719d499f6025b56652d8282d5a52f3722dc4

commit 8b0b719d499f6025b56652d8282d5a52f3722dc4
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Jul 21 14:22:27 2023 +0100

    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>

Diff:
---
 winsup/cygwin/syscalls.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 32ace4d38..f1cd5693e 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);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-21 13:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 13:34 [newlib-cygwin] Cygwin: Fix uninitialized use of fh in strace output in stat_worker() Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).