diff options
Diffstat (limited to 'bind.c')
-rw-r--r-- | bind.c | 16 |
1 files changed, 14 insertions, 2 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); } |