From 52608c9fbfa4a97911f409e9bb9f25fe914ea916 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Tue, 27 Feb 2001 20:50:34 +0000 Subject: [PATCH] Fix indent endless on garbage input (i.e., if it encountered EOF while waiting for a '}' nesting terminator) Obtained from: OpenBSD rev 1.8 --- usr.bin/indent/indent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/indent/indent.c b/usr.bin/indent/indent.c index c790720ea1c3..447c8e28fe06 100644 --- a/usr.bin/indent/indent.c +++ b/usr.bin/indent/indent.c @@ -997,7 +997,7 @@ check_type: if (buf_ptr >= buf_end) fill_buffer(); } - while (*buf_ptr != '\n' || in_comment) { + while (*buf_ptr != '\n' || (in_comment && !had_eof)) { CHECK_SIZE_LAB; *e_lab = *buf_ptr++; if (buf_ptr >= buf_end)