[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dd: add 'skip_bytes' and 'count_bytes' operands
From: |
Pádraig Brady |
Subject: |
Re: dd: add 'skip_bytes' and 'count_bytes' operands |
Date: |
Mon, 13 Feb 2012 13:12:59 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
I've just noticed a couple of edge case issues.
The first hunk is for when not doing I/O,
ftruncate() should be on the full size.
The second, will not invalidate cache for the whole file,
if 0 < count < ibs
cheers,
Pádraig.
--- a/src/dd.c
+++ b/src/dd.c
@@ -2170,7 +2170,7 @@ main (int argc, char **argv)
if (seek_records != 0 && !(conversions_mask & C_NOTRUNC))
{
- uintmax_t size = seek_records * output_blocksize;
+ uintmax_t size = seek_records * output_blocksize + seek_bytes;
unsigned long int obs = output_blocksize;
if (OFF_T_MAX / output_blocksize < seek_records)
@@ -2207,7 +2207,7 @@ main (int argc, char **argv)
exit_status = dd_copy ();
- if (max_records == 0)
+ if (max_records == 0 && max_bytes == 0)
{
/* Special case to invalidate cache to end of file. */
if (i_nocache && !invalidate_cache (STDIN_FILENO, 0))
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, (continued)
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/08
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/08
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Eric Blake, 2012/02/08
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Erik Auerswald, 2012/02/08
- RE: dd: add 'skip_bytes' and 'count_bytes' operands, Voelker, Bernhard, 2012/02/09
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/08
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/08
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/10
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/10
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/11
- Re: dd: add 'skip_bytes' and 'count_bytes' operands,
Pádraig Brady <=
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Bernhard Voelker, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Jérémy Compostella, 2012/02/13
- Re: dd: add 'skip_bytes' and 'count_bytes' operands, Pádraig Brady, 2012/02/13