* fix-header.c (main): Move inf_buffer termination and inf_limit
calculation to after read.
From-SVN: r47307
Sat Nov 24 17:04:10 2001 Douglas B. Rupp <rupp@gnat.com>
+ * fix-header.c (main): Move inf_buffer termination and inf_limit
+ calculation to after read.
+
* config/alpha/xm-vms.h (FILE_TYPE): Remove undef and baggage.
(__UNIX_FOPEN): Define.
}
inf_size = sbuf.st_size;
inf_buffer = (char *) xmalloc (inf_size + 2);
- inf_buffer[inf_size] = '\n';
- inf_buffer[inf_size + 1] = '\0';
- inf_limit = inf_buffer + inf_size;
inf_ptr = inf_buffer;
to_read = inf_size;
close (inf_fd);
+ /* Inf_size may have changed if read was short (as on VMS) */
+ inf_buffer[inf_size] = '\n';
+ inf_buffer[inf_size + 1] = '\0';
+ inf_limit = inf_buffer + inf_size;
+
/* If file doesn't end with '\n', add one. */
if (inf_limit > inf_buffer && inf_limit[-1] != '\n')
inf_limit++;