shithub: plan9front

Download patch

ref: 8aa69e55b6a441ab7b0d243d548ac202bcd31324
parent: 8d578014cf6a76c55e6178d96ffd3c2ad134641a
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Jun 6 19:50:45 EDT 2021

git: avoid uninterruptible temporary warning

dont' fall into the rathole.

--- a/sys/src/cmd/git/pack.c	Sun Jun  6 18:44:36 2021
+++ b/sys/src/cmd/git/pack.c	Sun Jun  6 19:50:45 2021
@@ -1000,7 +1000,8 @@
 	retried = 0;
 retry:
 	for(i = 0; i < npackf; i++){
-		if((o = searchindex(packf[i].idx, packf[i].nidx, h)) != -1){
+		o = searchindex(packf[i].idx, packf[i].nidx, h);
+		if(o != -1){
 			if((f = openpack(&packf[i])) == nil)
 				goto error;
 			if((r = Bseek(f, o, 0)) != -1)
--- a/sys/src/cmd/git/save.c	Sun Jun  6 18:44:36 2021
+++ b/sys/src/cmd/git/save.c	Sun Jun  6 19:50:45 2021
@@ -351,7 +351,6 @@
 	Object *t;
 
 	gitinit();
-	gitinit();
 	if(access(".git", AEXIST) != 0)
 		sysfatal("could not find git repo: %r");
 	if(getwd(cwd, sizeof(cwd)) == nil)
--- a/sys/src/cmd/git/util.c	Sun Jun  6 18:44:36 2021
+++ b/sys/src/cmd/git/util.c	Sun Jun  6 19:50:45 2021
@@ -67,7 +67,8 @@
 	uvlong na;
 	void *v;
 
-	if((na = (uvlong)n*(uvlong)sz) >= (1ULL<<30))
+	na = (uvlong)n*(uvlong)sz;
+	if(na >= (1ULL<<30))
 		sysfatal("alloc: overflow");
 	v = mallocz(na, 1);
 	if(v == nil)
@@ -94,7 +95,8 @@
 	uvlong na;
 	void *v;
 
-	if((na = (uvlong)n*(uvlong)sz) >= (1ULL<<30))
+	na = (uvlong)n*(uvlong)sz;
+	if(na >= (1ULL<<30))
 		sysfatal("alloc: overflow");
 	v = realloc(p, na);
 	if(v == nil)