diff options
author | Pádraig Brady <P@draigBrady.com> | 2008-11-20 10:28:31 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2009-01-28 15:14:57 +0000 |
commit | 460ebb078ed7bf249af745d8725d6c37e7f15b57 (patch) | |
tree | a421119bbced4575fad05e74245ad7995a889355 /.gitignore | |
parent | 0d5508de1358319c32b757d8593c3862465fe916 (diff) | |
download | coreutils-460ebb078ed7bf249af745d8725d6c37e7f15b57.tar.xz |
dd: Better handle user specified offsets that are too big
Following are the before and after operations for seekable files,
for the various erroneous offsets handled by this patch:
skip beyond end of file
before: immediately exit(0);
after : immediately printf("cannot skip to specified offset"); exit(0);
skip > max file size
before: read whole file and exit(0);
after : immediately printf("cannot skip: Invalid argument"); exit(1);
seek > max file size
before: immediately printf("truncate error: EFBIG"); exit(1);
after : immediately printf("truncate error: EFBIG"); exit(1);
skip > OFF_T_MAX
before: read whole device/file and exit(0);
after : immediately printf("cannot skip:"); exit(1);
seek > OFF_T_MAX
before: immediately printf("truncate error: offset too large"); exit(1);
after : immediately printf("truncate error: offset too large"); exit(1);
skip > device size
before: read whole device and exit(0);
after : immediately printf("cannot skip: Invalid argument"); exit(1);
seek > device size
before: read whole device and printf("write error: ENOSPC"); exit(1);
after : immediately printf("cannot seek: Invalid argument"); exit(1);
* NEWS: Summarize this change in behavior.
* src/dd.c (skip): Add error checking for large seek/skip offsets on
seekable files, rather than deferring to using read() to advance offset.
(dd_copy): Print a warning if skip past EOF, as per FIXME comment.
* test/Makefile.am: Add 2 new tests.
* tests/dd/seek-skip-past-file: Add tests for first 3 cases above.
* tests/dd/seek-skip-past-dev: Add root only test for last case above.
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions