diff options
author | Chet Ramey <chet.ramey@case.edu> | 2024-08-03 13:24:40 -0400 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2024-08-03 13:24:40 -0400 |
commit | 9337fc44442954dd949ca7db027b164968e913c6 (patch) | |
tree | d401596bdba7dcc86ad2341fba152c7ede94b3e6 | |
parent | 5d4d92f221d6aac4be445bdd8cd9b48d9ac33f04 (diff) |
Readline-8.2 patch 11: readline should retry the open of the init file if interrupted by a signal
-rw-r--r-- | bind.c | 16 | ||||
-rw-r--r-- | patchlevel | 2 |
2 files changed, 15 insertions, 3 deletions
@@ -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); } @@ -1,3 +1,3 @@ # Do not edit -- exists only for use by patch -10 +11 |