steve@gec-mi-at.co.uk (Steve Lademann) (07/08/87)
Having spent the last couple of months upgrading two 11/750s to 4.3BSD, I
have encountered a few minor bugs which I have fixes for. Here's one in make.
Problem: There is a feature of make which is used quite often at this
site which has had a long-standing bug. If it is required to
make software from an ar library, then it is possible to
make use of the creation dates of the individual object modules
in the ar file. However, there is a bug in the code due to the
way in which ar module names are stored, in that they are held
in character arrays which are space-padded on the right. The
result is that the library modules are always rebuilt for
each make run. The patch below replaces these trailing spaces
with nulls after the name is retrieved from the ar library,
and prior to comparing it's name with the source file.
Fix:
*** files.c.old Tue Jun 23 13:48:41 1987
--- files.c Tue Jun 23 13:46:08 1987
***************
*** 1,5 ****
--- 1,9 ----
static char *sccsid = "@(#)files.c 4.12 (Berkeley) 86/01/09";
#include <fcntl.h>
+ /*
+ * Changed 20-Jan-87 by steve@gec-mi-at.co.uk to null out trailing spaces
+ * on library module name
+ */
/* UNIX DEPENDENT PROCEDURES */
***************
*** 519,524 ****
--- 523,529 ----
{
struct ar_hdr arhead;
long atol();
+ char *ptr;
arpos += (arflen + 1) & ~1L; /* round archived file length up to even */
if(arpos >= arlen)
***************
*** 535,540 ****
--- 540,549 ----
arfdate = arhead.ar_date;
#endif
strncpy(arfname, arhead.ar_name, sizeof(arhead.ar_name));
+ ptr = arfname+sizeof(arhead.ar_name);
+ /* Get rid of trailing spaces from name which ar manages to leave */
+ while (*--ptr == ' ')
+ *ptr = '\0';
return(1);
}
***************
*** 563,570 ****
--- 572,583 ----
{
register int i;
for(i = 0 ; i < n ; ++i)
+ {
if(*a++ != *b++)
return(NO);
+ if((*a == '\0') && (*b == '\0'))
+ break;
+ }
return(YES);
}
|Steve Lademann |Phone: 44 727 59292 x326 |
|Marconi Instruments Ltd|UUCP : ...mcvax!ukc!hrc63!miduet!steve |
|St. Albans AL4 0JN |NRS : steve@uk.co.gec-mi-at |
|Herts. UK | "disclaimers.all"