This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Mar 3 10:04, Pedro Alves wrote:On Thursday 03 March 2011 09:25:32, Joel Brobecker wrote:Can't we just memset `st' instead?I'm just wondering, can we assume that the stat structure has always an st_ino member? THere are checks for st_blocks and st_blksize in place already. Is the same required for st_ino?I think it's fine, at least for now. The good news is that this field is described in the Open Group's page for this type: http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html So I think we can count on it (although, I don't know enough about C to know how much authority this has)
But, regardless, I think we can leave it be until such day where we actually come across a system where the field actually does not exist... When that happens, we can easily fix the build failure.
That would be the simplest solution. Afterwards, just set the non-zero fields.
2011-03-03 Michael Snyder <msnyder@vmware.com> * 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
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |