From aacff154ea39c589ffe6dfb3c324cac4257151d8 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <simon@josefsson.org>
Date: Thu, 10 Nov 2005 14:50:28 +0000
Subject: [PATCH] Fix last commit (ChangeLog entry still applicable).

---
 lib/readline.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/readline.c b/lib/readline.c
index f2ddcaaaa1..88f39b2103 100644
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -48,9 +48,8 @@ readline (const char *prompt)
   if (getline (&out, &size, stdin) < 0)
     return NULL;
 
-  if (out[strlen (out) - 1] == '\r')
-    out[strlen (out) - 1] = '\0';
-  if (out[strlen (out) - 1] == '\n')
+  while (*out && (out[strlen (out) - 1] == '\r'
+		  || out[strlen (out) - 1] == '\n'))
     out[strlen (out) - 1] = '\0';
 
   return out;
-- 
2.39.5