aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'readline/histfile.c')
-rw-r--r--readline/histfile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/readline/histfile.c b/readline/histfile.c
index 60a91251b7a..c19630dc8f3 100644
--- a/readline/histfile.c
+++ b/readline/histfile.c
@@ -228,7 +228,10 @@ read_history_range (filename, from, to)
for (line_end = line_start; line_end < bufend; line_end++)
if (*line_end == '\n')
{
- *line_end = '\0';
+ if (line_end - 1 >= line_start && *(line_end - 1) == '\r')
+ *(line_end - 1) = '\0';
+ else
+ *line_end = '\0';
if (*line_start)
add_history (line_start);