mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-19 02:10:57 +02:00
dd: don’t trust st_size on /proc/files
* src/dd.c (skip): Don’t trust st_size == 0.
This commit is contained in:
2
src/dd.c
2
src/dd.c
@@ -1809,7 +1809,7 @@ skip (int fdesc, char const *file, intmax_t records, idx_t blocksize,
|
||||
struct stat st;
|
||||
if (ifstat (STDIN_FILENO, &st) != 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot fstat %s"), quoteaf (file));
|
||||
if (usable_st_size (&st) && 0 <= input_offset
|
||||
if (usable_st_size (&st) && 0 < st.st_size && 0 <= input_offset
|
||||
&& st.st_size - input_offset < offset)
|
||||
{
|
||||
/* When skipping past EOF, return the number of _full_ blocks
|
||||
|
||||
Reference in New Issue
Block a user