From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id A5B2C3858409; Fri, 21 Jul 2023 13:34:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5B2C3858409 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689946466; bh=98hjFDKszgaKd3oW47iBV5LagMt7cMk8u/2nABiYNaY=; h=From:To:Subject:Date:From; b=WCxU1nQpFBKTN/U6o0hNJtCj0Gj3+3S+UyJrlZO753gVk5BrslvUECseMPVNmzdLz lMT9WcMp5G4gYyVywB9LFpmcNJ1LMz0ASWVbN0tTuNDEjMk5qa6VSt+GTi8PxR0ulQ FA5nKHd2rFPqFV/ST0aasZW6SP66H92nguRqIwjc= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jon Turney To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: Fix uninitialized use of fh in strace output in stat_worker() X-Act-Checkin: newlib-cygwin X-Git-Author: Jon Turney X-Git-Refname: refs/heads/master X-Git-Oldrev: 42b44044b34d7c26abf84f8b24f820e04e1662f2 X-Git-Newrev: 8b0b719d499f6025b56652d8282d5a52f3722dc4 Message-Id: <20230721133426.A5B2C3858409@sourceware.org> Date: Fri, 21 Jul 2023 13:34:26 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D8b0b719d499= f6025b56652d8282d5a52f3722dc4 commit 8b0b719d499f6025b56652d8282d5a52f3722dc4 Author: Jon Turney Date: Fri Jul 21 14:22:27 2023 +0100 Cygwin: Fix uninitialized use of fh in strace output in stat_worker() =20 Move strace output to fix uninitalized use of fh introduced in previous= commit. =20 ../../../../src/winsup/cygwin/syscalls.cc: In function =E2=80=98int sta= t_worker(path_conv&, stat*)=E2=80=99: ../../../../src/winsup/cygwin/syscalls.cc:1971:69: error: =E2=80=98fh= =E2=80=99 may be used uninitialized [-Werror=3Dmaybe-uninitialized] =20 Fixes: 42b44044b34d ("Cygwin: Fix Windows file handle leak in stat("fil= e", -1)") Signed-off-by: Jon Turney 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; =20 - debug_printf ("(%S, %p, %p), file_attributes %d", - pc.get_nt_native_path (), buf, fh, (DWORD) *fh); memset (buf, 0, sizeof (*buf)); =20 if (!(fh =3D build_fh_pc (pc))) __leave; =20 + debug_printf ("(%S, %p, %p), file_attributes %d", + pc.get_nt_native_path (), buf, fh, (DWORD) *fh); + res =3D fh->fstat (buf); if (!res) fh->stat_fixup (buf);