Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Steven McCanne
Thu, 06 Aug 1992 02:35
gcc-2.2.2 bug in assumption of `struct stat' field
Author: 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. */
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads