scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit c503e20b9b2cdf0829b73809876b7af7770821df
parent f5875500757a400b8b8ad9377a39c3246a2999e8
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 10 Feb 2019 21:13:41 +0000

[ranlib] Fix merging index file

Diffstat:
Msrc/cmd/ranlib.c | 4++++
Msrc/libmach/coff32/coff32setidx.c | 4++--
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/cmd/ranlib.c b/src/cmd/ranlib.c @@ -211,6 +211,8 @@ merge(FILE *to, struct fprop *prop, FILE *lib, FILE *idx) index = namindex(artype); if (!strncmp(first.ar_name, index, SARNAM)) fseek(lib, atol(first.ar_size), SEEK_CUR); + else + fseek(lib, SARMAG, SEEK_SET); fwrite(ARMAG, SARMAG, 1, to); @@ -226,6 +228,8 @@ merge(FILE *to, struct fprop *prop, FILE *lib, FILE *idx) while ((c = getc(idx)) != EOF) putc(c, to); + if (prop->size & 1) + putc('\n', to); while ((c = getc(lib)) != EOF) putc(c, to); diff --git a/src/libmach/coff32/coff32setidx.c b/src/libmach/coff32/coff32setidx.c @@ -24,8 +24,8 @@ coff32setidx(int order, long nsyms, Objsymdef *head, FILE *fp) } for (def = head; def; def = def->next) { - len = strlen(def->name); - fwrite(def->name, len+1, 1, fp); + len = strlen(def->name) + 1; + fwrite(def->name, len, 1, fp); n += len; }