diff options
author | Russ Cox <rsc@golang.org> | 2020-01-12 15:05:40 -0500 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2020-01-12 15:07:42 -0500 |
commit | fafa622a5bdf71adfbb4334541c3b65f29c89ca9 (patch) | |
tree | 189d86fb978b151ddf2f303f9c4efab196d79f17 /src/lib9 | |
parent | fa325e9b42b0bdfb48857d1958d9fb7ceac55151 (diff) | |
download | plan9port-fafa622a5bdf71adfbb4334541c3b65f29c89ca9.tar.gz plan9port-fafa622a5bdf71adfbb4334541c3b65f29c89ca9.tar.bz2 plan9port-fafa622a5bdf71adfbb4334541c3b65f29c89ca9.zip |
all: fix or silence various gcc warnings
As usual, gcc finds some real problems but also reports a ton
of noise. Fix the problems and quiet the noise.
Diffstat (limited to 'src/lib9')
-rw-r--r-- | src/lib9/_p9dialparse.c | 2 | ||||
-rw-r--r-- | src/lib9/lrand.c | 12 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/lib9/_p9dialparse.c b/src/lib9/_p9dialparse.c index 2cc23574..4e56f5ee 100644 --- a/src/lib9/_p9dialparse.c +++ b/src/lib9/_p9dialparse.c @@ -72,7 +72,7 @@ p9dialparse(char *addr, char **pnet, char **punix, void *phost, int *pport) if((port = strchr(host, '!')) == nil){ if(strcmp(net, "unix")==0 || strcmp(net, "net")==0){ Unix: - if(strlen(host)+1 > sizeof ((struct sockaddr_un*)&ss)->sun_path){ + if(strlen(host)+1 > sizeof ((struct sockaddr_un*)ss)->sun_path){ werrstr("unix socket name too long"); return -1; } diff --git a/src/lib9/lrand.c b/src/lib9/lrand.c index 8f536456..3d1b05fe 100644 --- a/src/lib9/lrand.c +++ b/src/lib9/lrand.c @@ -63,17 +63,15 @@ p9lrand(void) lock(&lk); - rng_tap--; - if(rng_tap < rng_vec) { - if(rng_feed == 0) { + if(rng_tap <= rng_vec) { + if(rng_feed == 0) isrand(1); - rng_tap--; - } rng_tap += LEN; } - rng_feed--; - if(rng_feed < rng_vec) + rng_tap--; + if(rng_feed <= rng_vec) rng_feed += LEN; + rng_feed--; x = (*rng_feed + *rng_tap) & MASK; *rng_feed = x; |