diff options
author | Ron Yorston <rmy@pobox.com> | 2020-03-24 16:37:13 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2020-03-24 16:43:46 +0000 |
commit | e6680912a298dc2dee83f41837cb52160cf562d9 (patch) | |
tree | 90e61d8566d6279d8dfbb0c823b87c1cc91148d7 /coreutils | |
parent | 87a56761cf04eca49295f95f353f252a53b33a46 (diff) | |
download | busybox-w32-e6680912a298dc2dee83f41837cb52160cf562d9.tar.gz busybox-w32-e6680912a298dc2dee83f41837cb52160cf562d9.tar.bz2 busybox-w32-e6680912a298dc2dee83f41837cb52160cf562d9.zip |
dd: create a sparse file when seek=N is used
When the seek=N argument is used mark the file as sparse and set
the range that is sparse.
See https://stackoverflow.com/questions/4011508/how-to-create-a-sparse-file-on-ntfs
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/dd.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 3054ec6ea..fc8b1dbb2 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -502,6 +502,9 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
502 | } | 502 | } |
503 | if (seek) { | 503 | if (seek) { |
504 | size_t blocksz = (G.flags & FLAG_SEEK_BYTES) ? 1 : obs; | 504 | size_t blocksz = (G.flags & FLAG_SEEK_BYTES) ? 1 : obs; |
505 | #if ENABLE_PLATFORM_MINGW32 | ||
506 | seek_sparse(ofd, seek * blocksz); | ||
507 | #endif | ||
505 | if (lseek(ofd, seek * blocksz, SEEK_CUR) < 0) | 508 | if (lseek(ofd, seek * blocksz, SEEK_CUR) < 0) |
506 | goto die_outfile; | 509 | goto die_outfile; |
507 | } | 510 | } |