shithub: riscv

Download patch

ref: 79189ec2621e26b060ccb9d4a116a194bfe754ee
parent: a426c08ce22b9f9b256ab028c223b362e2519361
author: cinap_lenrek <[email protected]>
date: Thu Jan 10 22:16:30 EST 2013

mk: fix ar padding problems on 64bit (from eriks amd64mkar patch)

--- a/sys/src/cmd/mk/archive.c
+++ b/sys/src/cmd/mk/archive.c
@@ -60,12 +60,12 @@
 	if(symlook(name, S_TIME, 0)){
 		/* hoon off and change it in situ */
 		LSEEK(fd, SARMAG, 0);
-		while(read(fd, (char *)&h, sizeof(h)) == sizeof(h)){
+		while(read(fd, &h, SAR_HDR) == SAR_HDR){
 			for(i = SARNAME-1; i > 0 && h.name[i] == ' '; i--)
-					;
+				;
 			h.name[i+1]=0;
 			if(strcmp(member, h.name) == 0){
-				t = SARNAME-sizeof(h);	/* ughgghh */
+				t = SARNAME-SAR_HDR;	/* ughgghh */
 				LSEEK(fd, t, 1);
 				fprint(fd, "%-12ld", time(0));
 				break;
@@ -101,7 +101,7 @@
 	}
 	at = d->mtime;
 	free(d);
-	while(read(fd, (char *)&h, sizeof(h)) == sizeof(h)){
+	while(read(fd, &h, SAR_HDR) == SAR_HDR){
 		t = atol(h.date);
 		if(t >= at)	/* new things in old archives confuses mk */
 			t = at-1;