From b9842a615366b47cbd0739d97f2dd2679dfbb3a8 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Fri, 29 May 2015 15:33:59 +0100 Subject: maint: avoid new coverity warnings * src/sync.c (sync_arg): Initialise variable to avoid unitialized access if assert is disabled. * src/head.c (elide_tail_bytes_file): Support this function with ---presume-input-pipe and larger files, which regressed with commit v8.23-47-g2662702. (elide_tail_lines_file): Likewise. * src/dd.c (dd_copy): Explicitly don't try to ftruncate() upon failure to lseek() (the existing check against st_size was already protecting that). * src/factor.c (factor_using_squfof): Assert (only when linting due to performance) to avoid the implication of divide by zero. * src/od.c (read_block): Remove dead code. * src/tac.c (tac_seekable): Likewise. * src/ls.c (gobble_file): Likewise. --- src/head.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/head.c') diff --git a/src/head.c b/src/head.c index 3ea81b651..410cc4f49 100644 --- a/src/head.c +++ b/src/head.c @@ -458,7 +458,7 @@ elide_tail_bytes_file (const char *filename, int fd, uintmax_t n_elide, struct stat const *st, off_t current_pos) { off_t size = st->st_size; - if (size <= ST_BLKSIZE (*st)) + if (presume_input_pipe || size <= ST_BLKSIZE (*st)) return elide_tail_bytes_pipe (filename, fd, n_elide, current_pos); else { @@ -747,7 +747,7 @@ elide_tail_lines_file (const char *filename, int fd, uintmax_t n_elide, struct stat const *st, off_t current_pos) { off_t size = st->st_size; - if (size <= ST_BLKSIZE (*st)) + if (presume_input_pipe || size <= ST_BLKSIZE (*st)) return elide_tail_lines_pipe (filename, fd, n_elide, current_pos); else { -- cgit v1.2.3-54-g00ecf