diff options
author | nate <nate@FreeBSD.org> | 1994-12-23 22:55:00 +0000 |
---|---|---|
committer | nate <nate@FreeBSD.org> | 1994-12-23 22:55:00 +0000 |
commit | 15d87543df61b1d718a0d5813aea6e16620814d4 (patch) | |
tree | 714aa13ebc1fd0a4d22ce670153513fb454392a0 /usr.bin | |
parent | 1daa60a21040772f911e5fc3988447c73e4eaef8 (diff) | |
download | FreeBSD-src-15d87543df61b1d718a0d5813aea6e16620814d4.zip FreeBSD-src-15d87543df61b1d718a0d5813aea6e16620814d4.tar.gz |
Subject: ranlib fix for odd length long final file names (PR #82)
Submitted by: Peter Dufault <dufault@hda.com>
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ar/archive.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.bin/ar/archive.c b/usr.bin/ar/archive.c index 8a6fe2f..cd704b9 100644 --- a/usr.bin/ar/archive.c +++ b/usr.bin/ar/archive.c @@ -276,6 +276,7 @@ copy_ar(cfp, size) CF *cfp; off_t size; { + int pad_odd_read; static char pad = '\n'; off_t sz; int from, nr, nw, off, to; @@ -299,8 +300,12 @@ copy_ar(cfp, size) error(cfp->rname); } - if (cfp->flags & RPAD && (size + chdr.lname) & 1 && - (nr = read(from, buf, 1)) != 1) { + if (already_written) + pad_odd_read = (cfp->flags & RPAD) && ((size + chdr.lname) & 1); + else + pad_odd_read = (cfp->flags & RPAD) && (size & 1); + + if (pad_odd_read && (nr = read(from, buf, 1)) != 1) { if (nr == 0) badfmt(); error(cfp->rname); |