From 6e544287202c4c2741a6443b1d3a32dec0f67c0c Mon Sep 17 00:00:00 2001 From: eliz Date: Thu, 6 Apr 2000 15:24:36 +0000 Subject: [PATCH] * top.c (filename_completer): Set subsequent_name to 1 early on, to prevent an infinite loop if the first file in the directory is a backup file. --- gdb/ChangeLog | 6 ++++++ gdb/top.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2ac78b274e..2d684f9bbc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2000-04-06 Eli Zaretskii + + * top.c (filename_completer): Set subsequent_name to 1 early on, + to prevent an infinite loop if the first file in the directory is + a backup file (whose name ends in a `~'). + 2000-04-05 Jim Blandy * solib.c (update_solib_list): New function. diff --git a/gdb/top.c b/gdb/top.c index dd5a8c3a60..7c996499db 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -1887,6 +1887,11 @@ filename_completer (text, word) return_val[return_val_used++] = p; break; } + /* We need to set subsequent_name to a non-zero value before the + continue line below, because otherwise, if the first file seen + by GDB is a backup file whose name ends in a `~', we will loop + indefinitely. */ + subsequent_name = 1; /* Like emacs, don't complete on old versions. Especially useful in the "source" command. */ if (p[strlen (p) - 1] == '~') @@ -1916,7 +1921,6 @@ filename_completer (text, word) free (p); } } - subsequent_name = 1; } #if 0 /* There is no way to do this just long enough to affect quote inserting -- 2.11.0