Fix odd length long names

Submitted by: dufault@hda.com
also Obtained from: 1.1.5.1
This commit is contained in:
Andrey A. Chernov 1994-12-17 05:59:33 +00:00
parent 763424fcf0
commit 632a24451c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=5132
2 changed files with 4 additions and 5 deletions

View File

@ -299,7 +299,8 @@ copy_ar(cfp, size)
error(cfp->rname);
}
if (cfp->flags & RPAD && size & 1 && (nr = read(from, buf, 1)) != 1) {
if (cfp->flags & RPAD && (size + chdr.lname) & 1 &&
(nr = read(from, buf, 1)) != 1) {
if (nr == 0)
badfmt();
error(cfp->rname);

View File

@ -126,10 +126,8 @@ int
compare(dest)
char *dest;
{
if (options & AR_TR)
return (!strncmp(chdr.name, rname(dest), OLDARMAXNAME));
return (!strcmp(chdr.name, rname(dest)));
int maxname = (options & AR_TR) ? OLDARMAXNAME : MAXNAMLEN;
return (!strncmp(chdr.name, rname(dest), maxname));
}
void