From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4632 invoked by alias); 3 Mar 2011 17:35:28 -0000 Received: (qmail 1535 invoked by uid 22791); 3 Mar 2011 17:35:15 -0000 X-Spam-Check-By: sourceware.org Received: from aquarius.hirmke.de (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.83/v0.83-20-g38e4449) with ESMTP; Thu, 03 Mar 2011 17:35:01 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 927CE2C02B8; Thu, 3 Mar 2011 18:34:58 +0100 (CET) Date: Thu, 03 Mar 2011 17:35:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: Re: [rfa] remote-fileio.c, remote_fileio_func_fstat, uninitialized st.st_ino. Message-ID: <20110303173458.GB16894@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org References: <4D6EBB4A.9080207@vmware.com> <20110303082857.GA10587@calimero.vinschen.de> <20110303092532.GW30306@adacore.com> <201103031004.02585.pedro@codesourcery.com> <20110303105029.GA22636@calimero.vinschen.de> <4D6FCE37.1090902@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4D6FCE37.1090902@vmware.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00191.txt.bz2 On Mar 3 09:21, Michael Snyder wrote: > Corinna Vinschen wrote: > >On Mar 3 10:04, Pedro Alves wrote: > >>Can't we just memset `st' instead? > > > >That would be the simplest solution. Afterwards, just set the > >non-zero fields. > > OK, how about this? > > 2011-03-03 Michael Snyder <...> > > * remote-fileio.c (remote_fileio_func_fstat): Initialize all > fields of struct 'st' to zero. > > Index: remote-fileio.c > =================================================================== > RCS file: /cvs/src/src/gdb/remote-fileio.c,v > retrieving revision 1.40 > diff -u -p -u -p -r1.40 remote-fileio.c > --- remote-fileio.c 25 Jan 2011 11:54:00 -0000 1.40 > +++ remote-fileio.c 3 Mar 2011 17:20:06 -0000 > @@ -1173,20 +1173,15 @@ remote_fileio_func_fstat (char *buf) > if (fd == FIO_FD_CONSOLE_IN || fd == FIO_FD_CONSOLE_OUT) > { > remote_fileio_to_fio_uint (1, fst.fst_dev); > + memset (&st, 0, sizeof (st)); > st.st_mode = S_IFCHR | (fd == FIO_FD_CONSOLE_IN ? S_IRUSR : S_IWUSR); > st.st_nlink = 1; > #ifdef HAVE_GETUID > st.st_uid = getuid (); > -#else > - st.st_uid = 0; > #endif > #ifdef HAVE_GETGID > st.st_gid = getgid (); > -#else > - st.st_gid = 0; > #endif > - st.st_rdev = 0; > - st.st_size = 0; > #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE > st.st_blksize = 512; > #endif Perfect. Thanks, Corinna -- Corinna Vinschen Cygwin Project Co-Leader Red Hat