[1/4] Readline-8.0 patch 1: fix file descriptor leak with zero-length history file

Message ID 20200614201623.11743-2-tom@tromey.com
State New
Headers show
Series
  • Import readline 8.0 patches
Related show

Commit Message

Tom Tromey June 14, 2020, 8:16 p.m.
From: Chet Ramey <chet.ramey@case.edu>


---
 readline/readline/histfile.c | 1 +
 readline/readline/patchlevel | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

-- 
2.17.2

Patch

diff --git a/readline/readline/histfile.c b/readline/readline/histfile.c
index dc64bde1c5a..a8a92aa3604 100644
--- a/readline/readline/histfile.c
+++ b/readline/readline/histfile.c
@@ -305,6 +305,7 @@  read_history_range (const char *filename, int from, int to)
   if (file_size == 0)
     {
       free (input);
+      close (file);
       return 0;	/* don't waste time if we don't have to */
     }
 
diff --git a/readline/readline/patchlevel b/readline/readline/patchlevel
index d8c9df7e6bb..fdf474049fc 100644
--- a/readline/readline/patchlevel
+++ b/readline/readline/patchlevel
@@ -1,3 +1,3 @@ 
 # Do not edit -- exists only for use by patch
 
-0
+1