Article View: gnu.gcc.bug
Article #278gcc-2.2.2 bug in assumption of `struct stat' field
From: Steven McCanne
Date: Thu, 06 Aug 1992 02:35
Date: Thu, 06 Aug 1992 02:35
40 lines
1598 bytes
1598 bytes
Gcc passes the st_size field of a `struct stat' as an (unprototyped) function
argument. On some systems (i.e., 4.4BSD) the st_size field isn't 32 bits
(it's 64 bits). The patch below fixes this problem.
Steve
-----
*** /tmp/,RCSt1a06497 Wed Aug 5 19:32:17 1992
--- gcc.c Wed Aug 5 19:31:59 1992
***************
*** 580,585 ****
--- 580,586 ----
struct stat statbuf;
char *buffer;
register char *p;
+ unsigned size;
if (verbose_flag)
fprintf (stderr, "Reading specs from %s\n", filename);
***************
*** 592,600 ****
pfatal_with_name (filename);
/* Read contents of file into BUFFER. */
! buffer = xmalloc (statbuf.st_size + 1);
! read (desc, buffer, statbuf.st_size);
! buffer[statbuf.st_size] = 0;
close (desc);
/* Scan BUFFER for specs, putting them in the vector. */
--- 593,602 ----
pfatal_with_name (filename);
/* Read contents of file into BUFFER. */
! size = statbuf.st_size;
! buffer = xmalloc (size + 1);
! read (desc, buffer, (size_t)size);
! buffer[size] = 0;
close (desc);
/* Scan BUFFER for specs, putting them in the vector. */
Technical Details
Message-ID:
<9208060235.AA06601@horse.ee.lbl.gov>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!horse.ee.lbl.gov!mccanneShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!horse.ee.lbl.gov!mccanne From: mccanne@horse.ee.lbl.gov (Steven McCanne) Subject: gcc-2.2.2 bug in assumption of `struct stat' field Message-ID: <9208060235.AA06601@horse.ee.lbl.gov> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Thu, 6 Aug 1992 02:35:55 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 41