X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/a68924a6e07d69bc4b8d6106b3af0ac5a7490905..8636089b170e999e5da4d94d1ab6ddb28f86b93b:/usr/src/cmd/strip.c diff --git a/usr/src/cmd/strip.c b/usr/src/cmd/strip.c index 80890c9b4a..b74747c7bf 100644 --- a/usr/src/cmd/strip.c +++ b/usr/src/cmd/strip.c @@ -1,10 +1,13 @@ #include #include +#include + +#define BUFSIZ BSIZE char *tname; char *mktemp(); struct exec head; -int a_magic[] = {A_MAGIC1, A_MAGIC2, A_MAGIC3, A_MAGIC4, 0}; +int a_magic[] = {A_MAGIC1, A_MAGIC2, A_MAGIC3, A_MAGIC4, 0412, 0413, 0}; int status; int tf; @@ -54,16 +57,18 @@ char *name; status = 1; goto out; } - if(head.a_syms == 0 && (head.a_flag&1) != 0) { + if ((head.a_syms == 0) && (head.a_trsize == 0) && (head.a_drsize ==0)) { printf("%s already stripped\n", name); goto out; } size = (long)head.a_text + head.a_data; - head.a_syms = 0; - head.a_flag |= 1; + head.a_syms = head.a_trsize = head.a_drsize = 0 ; lseek(tf, (long)0, 0); write(tf, (char *)&head, sizeof(head)); + if (head.a_magic == 0412 || head.a_magic == 0413) { + size += PAGSIZ - sizeof (head); + } if(copy(name, f, tf, size)) { status = 1; goto out; @@ -89,11 +94,11 @@ char *name; long size; { register s, n; - char buf[512]; + char buf[BUFSIZ]; while(size != 0) { - s = 512; - if(size < 512) + s = BUFSIZ; + if(size < BUFSIZ) s = size; n = read(fr, buf, s); if(n != s) {