From: Jim Meyering Date: Sun, 14 Jul 1996 22:24:28 +0000 (+0000) Subject: (unexpand): Fix bug that contributed to endless loop X-Git-Tag: TEXTUTILS-1_19b~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=178f23fbb719a46f16e4426615731984e77dfb14;p=thirdparty%2Fcoreutils.git (unexpand): Fix bug that contributed to endless loop when invoking `echo ' ' |unexpand -t 1,2': use print_tab_index, not tab_index in inner flush_pend: while loop. From Keith Owens . --- diff --git a/src/unexpand.c b/src/unexpand.c index 1fbda7fc8e..f5c91c00d5 100644 --- a/src/unexpand.c +++ b/src/unexpand.c @@ -290,10 +290,10 @@ unexpand (void) { if (tab_size == 0) { - /* Do not let tab_index == first_free_tab; + /* Do not let print_tab_index == first_free_tab; stop when it is 1 less. */ - while (tab_index < first_free_tab - 1 - && column >= tab_list[tab_index]) + while (print_tab_index < first_free_tab - 1 + && column >= tab_list[print_tab_index]) print_tab_index++; next_tab_column = tab_list[print_tab_index]; if (print_tab_index < first_free_tab - 1)