mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03: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:
1 parent
225cb8d747
commit
ac6b8d8224
1 file changed
+1
-1
@@ -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