diff options
author | 2002-05-10 19:13:07 +0000 | |
---|---|---|
committer | 2002-05-10 19:13:07 +0000 | |
commit | 1f2c089e7747abb2a74eeddb950dc680b61bdc06 (patch) | |
tree | 567b6fa3bcbdf5b97fc37f5ea55a2674b8b8de43 | |
parent | on ServerWorks CNB20HE Host: (diff) | |
download | wireguard-openbsd-1f2c089e7747abb2a74eeddb950dc680b61bdc06.tar.xz wireguard-openbsd-1f2c089e7747abb2a74eeddb950dc680b61bdc06.zip |
In getlin(): match and handle EOF before checking isprint()
millert ok.
-rw-r--r-- | usr.bin/unifdef/unifdef.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/usr.bin/unifdef/unifdef.c b/usr.bin/unifdef/unifdef.c index 213e956fe55..751c1570e5e 100644 --- a/usr.bin/unifdef/unifdef.c +++ b/usr.bin/unifdef/unifdef.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unifdef.c,v 1.4 2002/02/16 21:27:56 millert Exp $ */ +/* $OpenBSD: unifdef.c,v 1.5 2002/05/10 19:13:07 jason Exp $ */ /* $NetBSD: unifdef.c,v 1.6 1998/10/08 01:31:59 wsanchez Exp $ */ /* @@ -47,7 +47,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)unifdef.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$OpenBSD: unifdef.c,v 1.4 2002/02/16 21:27:56 millert Exp $"; +static char rcsid[] = "$OpenBSD: unifdef.c,v 1.5 2002/05/10 19:13:07 jason Exp $"; #endif /* not lint */ /* @@ -587,6 +587,8 @@ getlin(line, maxline, inp, expandtabs) #endif /* FFSPECIAL */ while (num + 8 < maxline) { /* leave room for tab */ chr = getc(inp); + if (chr == EOF) + return EOF; if (isprint(chr)) { #ifdef FFSPECIAL ent: @@ -595,9 +597,6 @@ getlin(line, maxline, inp, expandtabs) num++; } else switch (chr) { - case EOF: - return EOF; - case '\t': if (expandtabs) { num += tmp = 8 - (num & 7); |