* 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.
if (S_ISREG (stdout_stat.st_mode) || S_TYPEISSHM (&stdout_stat))
{
off_t output_offset = lseek (STDOUT_FILENO, 0, SEEK_CUR);
- if (output_offset > stdout_stat.st_size)
+ if (0 <= output_offset && stdout_stat.st_size < output_offset)
{
if (iftruncate (STDOUT_FILENO, output_offset) != 0)
{
div_smallq (q, rem, S+P, Q);
P1 = S - rem; /* P1 = q*Q - P */
+ IF_LINT (assert (q > 0 && Q > 0));
+
#if STAT_SQUFOF
- assert (q > 0);
q_freq[0]++;
q_freq[MIN (q, Q_FREQ_SIZE)]++;
#endif
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
{
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
{
|| ((print_inode || format_needs_type)
&& (type == symbolic_link || type == unknown)
&& (dereference == DEREF_ALWAYS
- || (command_line_arg && dereference != DEREF_NEVER)
|| color_symlink_as_referent || check_symlink_color))
/* Command line dereferences are already taken care of by the above
assertion that the inode number is not yet known. */
*n_bytes_in_buffer = 0;
- if (n == 0)
- return true;
-
while (in_stream != NULL) /* EOF. */
{
size_t n_needed;
if (ret == true)
{
- int sync_status;
+ int sync_status = -1;
switch (mode)
{
'G_buffer_size'. */
char *newbuffer;
size_t offset = sentinel_length ? sentinel_length : 1;
- ptrdiff_t match_start_offset = match_start - G_buffer;
- ptrdiff_t past_end_offset = past_end - G_buffer;
size_t old_G_buffer_size = G_buffer_size;
read_size *= 2;
xalloc_die ();
newbuffer = xrealloc (G_buffer - offset, G_buffer_size);
newbuffer += offset;
- /* Adjust the pointers for the new buffer location. */
- match_start = newbuffer + match_start_offset;
- past_end = newbuffer + past_end_offset;
G_buffer = newbuffer;
}