From 8aa69e55b6a441ab7b0d243d548ac202bcd31324 Mon Sep 17 00:00:00 2001 From: Ori Bernstein Date: Sun, 6 Jun 2021 23:50:45 +0000 Subject: [PATCH] git: avoid uninterruptible temporary warning dont' fall into the rathole. --- sys/src/cmd/git/pack.c | 3 ++- sys/src/cmd/git/save.c | 1 - sys/src/cmd/git/util.c | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/src/cmd/git/pack.c b/sys/src/cmd/git/pack.c index 893e4cd85..12215bdcd 100644 --- a/sys/src/cmd/git/pack.c +++ b/sys/src/cmd/git/pack.c @@ -1000,7 +1000,8 @@ readidxobject(Biobuf *idx, Hash h, int flag) 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) diff --git a/sys/src/cmd/git/save.c b/sys/src/cmd/git/save.c index 5275817ba..a9f0f5162 100644 --- a/sys/src/cmd/git/save.c +++ b/sys/src/cmd/git/save.c @@ -350,7 +350,6 @@ main(int argc, char **argv) vlong date; Object *t; - gitinit(); gitinit(); if(access(".git", AEXIST) != 0) sysfatal("could not find git repo: %r"); diff --git a/sys/src/cmd/git/util.c b/sys/src/cmd/git/util.c index 206175106..5ae897d3a 100644 --- a/sys/src/cmd/git/util.c +++ b/sys/src/cmd/git/util.c @@ -67,7 +67,8 @@ eamalloc(ulong n, ulong sz) 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 @@ earealloc(void *p, ulong n, ulong sz) 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)