]> git.ipfire.org Git - thirdparty/readline.git/commitdiff
Readline-8.2 patch 11: readline should retry the open of the init file if interrupted...
authorChet Ramey <chet.ramey@case.edu>
Sat, 3 Aug 2024 17:24:40 +0000 (13:24 -0400)
committerChet Ramey <chet.ramey@case.edu>
Sat, 3 Aug 2024 17:24:40 +0000 (13:24 -0400)
bind.c
patchlevel

diff --git a/bind.c b/bind.c
index 2596006ba43bb0c672b03b0b112970c60782d509..880db8ccc94389f2dc399c708c237a05505d5844 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -978,11 +978,20 @@ _rl_read_file (char *filename, size_t *sizep)
   char *buffer;
   int i, file;
 
-  file = -1;
-  if (((file = open (filename, O_RDONLY, 0666)) < 0) || (fstat (file, &finfo) < 0))
+  file = open (filename, O_RDONLY, 0666);
+  /* If the open is interrupted, retry once */
+  if (file < 0 && errno == EINTR)
     {
+      RL_CHECK_SIGNALS ();
+      file = open (filename, O_RDONLY, 0666);
+    }
+  
+  if ((file < 0) || (fstat (file, &finfo) < 0))
+    {
+      i = errno;
       if (file >= 0)
        close (file);
+      errno = i;
       return ((char *)NULL);
     }
 
@@ -991,10 +1000,13 @@ _rl_read_file (char *filename, size_t *sizep)
   /* check for overflow on very large files */
   if (file_size != finfo.st_size || file_size + 1 < file_size)
     {
+      i = errno;
       if (file >= 0)
        close (file);
 #if defined (EFBIG)
       errno = EFBIG;
+#else
+      errno = i;
 #endif
       return ((char *)NULL);
     }
index 810c277538226e77e2692e73a95b5c2087b1d179..f01eabb2db51da9271152b27f664fcefce5d6456 100644 (file)
@@ -1,3 +1,3 @@
 # Do not edit -- exists only for use by patch
 
-10
+11