aboutsummaryrefslogtreecommitdiffstats
path: root/src/split.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2021-01-25 14:12:48 +0000
committerPádraig Brady <P@draigBrady.com>2021-01-25 21:39:09 +0000
commitbb21daa125aeb4e32546309d370918ca47e612db (patch)
tree4ea33eb5f5e6cce1cf144535e5063c93058510d2 /src/split.c
parentdoc: rmdir --recursive substitutes (diff)
downloadcoreutils-bb21daa125aeb4e32546309d370918ca47e612db.tar.gz
coreutils-bb21daa125aeb4e32546309d370918ca47e612db.zip
split: fix --number=K/N to output correct part of file
This functionality regressed with the adjustments in commit v8.25-4-g62e7af032 * src/split.c (bytes_chunk_extract): Account for already read data when seeking into the file. * tests/split/b-chunk.sh: Use the hidden ---io-blksize option, to test this functionality. * NEWS: Mention the bug fix. Fixes https://bugs.gnu.org/46048
Diffstat (limited to 'src/split.c')
-rw-r--r--src/split.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/split.c b/src/split.c
index 0660da13f..59c234c12 100644
--- a/src/split.c
+++ b/src/split.c
@@ -1001,7 +1001,7 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize,
}
else
{
- if (lseek (STDIN_FILENO, start, SEEK_CUR) < 0)
+ if (lseek (STDIN_FILENO, start - initial_read, SEEK_CUR) < 0)
die (EXIT_FAILURE, errno, "%s", quotef (infile));
initial_read = SIZE_MAX;
}