diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2014-11-05 12:29:58 -0500 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2014-11-05 12:29:58 -0500 |
commit | c483c50817e8accd0d5052d41d00869330193175 (patch) | |
tree | b79aa201d973180fe1d868befb6602c68d2758f3 /io.c | |
parent | 6a9d48365f5044b64a6c270760808d17d475ca4b (diff) | |
download | egawk-c483c50817e8accd0d5052d41d00869330193175.tar.gz egawk-c483c50817e8accd0d5052d41d00869330193175.tar.bz2 egawk-c483c50817e8accd0d5052d41d00869330193175.zip |
If getline fails due to a retryable I/O error, return -2 without closing the file only if PROCINFO[<name>, "RETRY"] is configured.
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -3425,6 +3425,13 @@ find_longest_terminator: return REC_OK; } +/* return true if PROCINFO[<filename>, "RETRY"] exists */ +static inline int +retryable(IOBUF *iop) +{ + return PROCINFO_node && in_PROCINFO(iop->public.name, "RETRY", NULL); +} + /* Does the I/O error indicate that the operation should be retried later? */ static inline int @@ -3500,7 +3507,7 @@ get_a_record(char **out, /* pointer to pointer to data */ return EOF; } else if (iop->count == -1) { *errcode = errno; - if (errno_io_retry()) + if (errno_io_retry() && retryable(iop)) return -2; iop->flag |= IOP_AT_EOF; return EOF; @@ -3576,7 +3583,7 @@ get_a_record(char **out, /* pointer to pointer to data */ iop->count = iop->public.read_func(iop->public.fd, iop->dataend, amt_to_read); if (iop->count == -1) { *errcode = errno; - if (errno_io_retry()) + if (errno_io_retry() && retryable(iop)) return -2; iop->flag |= IOP_AT_EOF; break; |