diff options
Diffstat (limited to 'contrib/libdiff')
| -rw-r--r-- | contrib/libdiff/include/diff_main.h | 1 | ||||
| -rw-r--r-- | contrib/libdiff/lib/diff_atomize_text.c | 12 |
2 files changed, 7 insertions, 6 deletions
diff --git a/contrib/libdiff/include/diff_main.h b/contrib/libdiff/include/diff_main.h index 11700580db4b..04a6c6e748c9 100644 --- a/contrib/libdiff/include/diff_main.h +++ b/contrib/libdiff/include/diff_main.h @@ -118,7 +118,6 @@ struct diff_data { /* Flags set by file atomizer. */ #define DIFF_ATOMIZER_FOUND_BINARY_DATA 0x00000001 -#define DIFF_ATOMIZER_FILE_TRUNCATED 0x00000002 /* Flags set by caller of diff_main(). */ #define DIFF_FLAG_IGNORE_WHITESPACE 0x00000001 diff --git a/contrib/libdiff/lib/diff_atomize_text.c b/contrib/libdiff/lib/diff_atomize_text.c index d8a69733fc00..9ed611cce4b2 100644 --- a/contrib/libdiff/lib/diff_atomize_text.c +++ b/contrib/libdiff/lib/diff_atomize_text.c @@ -141,6 +141,7 @@ diff_data_atomize_text_lines_mmap(struct diff_data *d) bool embedded_nul = false; unsigned int array_size_estimate = d->len / 50; unsigned int pow2 = 1; + int ret = DIFF_RC_OK; while (array_size_estimate >>= 1) pow2++; @@ -152,13 +153,14 @@ diff_data_atomize_text_lines_mmap(struct diff_data *d) sigaction(SIGBUS, &act, &oact); if (sigsetjmp(diff_data_signal_env, 0) > 0) { /* - * The file was truncated while we were reading it. Set - * the end pointer to the beginning of the line we were - * trying to read, adjust the file length, and set a flag. + * The file was truncated while we were reading it, or an + * I/O error occurred. Set the end pointer to the + * beginning of the line we were trying to read, adjust + * the file length, and set the return value to an error. */ end = pos; d->len = end - d->data; - d->atomizer_flags |= DIFF_ATOMIZER_FILE_TRUNCATED; + ret = EIO; } while (pos < end) { const uint8_t *line_start = pos, *line_end = pos; @@ -203,7 +205,7 @@ diff_data_atomize_text_lines_mmap(struct diff_data *d) if (embedded_nul) d->atomizer_flags |= DIFF_ATOMIZER_FOUND_BINARY_DATA; - return DIFF_RC_OK; + return ret; } static int |
