From: ian Date: Sat, 25 Sep 1999 01:06:04 +0000 (+0000) Subject: Bugfixes: use -O2, and defend against fgets giving an empty string. X-Git-Tag: branchpoint-1996-06-19-retrospective-beforeuserv~9 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv-utils.git;a=commitdiff_plain;h=2c310400b1f8dafa3475bfc0efdba14359603c66 Bugfixes: use -O2, and defend against fgets giving an empty string. --- diff --git a/ipif/Makefile b/ipif/Makefile index 24d74ad..0d89ae0 100644 --- a/ipif/Makefile +++ b/ipif/Makefile @@ -1,7 +1,8 @@ # +OPTIMISE= -O2 CFLAGS= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith \ - -Wwrite-strings -g -D_GNU_SOURCE + -Wwrite-strings -g $(OPTIMISE) -D_GNU_SOURCE etcdir= /etc prefix= /usr/local diff --git a/ipif/service.c b/ipif/service.c index 0050dd2..18322d4 100644 --- a/ipif/service.c +++ b/ipif/service.c @@ -276,6 +276,7 @@ static void permit(unsigned long pprefix, unsigned long pmask) { int i, any; assert(!(pprefix & ~pmask)); + any= 0; if (!proto) fputs("permits",stdout); if (addrnet_isin(localaddr,~0UL, pprefix,pmask)) { @@ -679,7 +680,7 @@ static void startslattach(void) { } setsigmask(&fullset); l= strlen(ifnbuf); - if (l<0 || ifnbuf[l-1] != '\n') fatal("slattach gave strange output `%s'",ifnbuf); + if (l<=0 || ifnbuf[l-1] != '\n') fatal("slattach gave strange output `%s'",ifnbuf); ifnbuf[l-1]= 0; for (k=l; k>0 && ifnbuf[k-1]!=' '; k--); ifname= ifnbuf+k;