summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2011-05-20 01:10:58 +0100
committerPádraig Brady <P@draigBrady.com>2011-05-26 00:28:14 +0100
commit41139da2e774dd352ea4566d72f2f3818e0338e7 (patch)
treec0eae0fb72470bd8d598c6572e9f89889252a4a1 /src
parentbfffa909477924eaaa2a5e20ee44be087b0ac87d (diff)
downloadcoreutils-41139da2e774dd352ea4566d72f2f3818e0338e7.tar.xz
maint: split: remove --filter specific code from other paths
* src/split.c (lines_chunk_split): Don't use ignore_error() which is redundant and confusing when not running with --filter. (lines_rr): Likewise. (ofile_open): Likewise. Add a comment to clarify that filters aren't restarted under file descriptor pressure.
Diffstat (limited to 'src')
-rw-r--r--src/split.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/split.c b/src/split.c
index 9e23f8689..95a2cccac 100644
--- a/src/split.c
+++ b/src/split.c
@@ -649,8 +649,7 @@ lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize,
/* We don't use the stdout buffer here since we're writing
large chunks from an existing file, so it's more efficient
to write out directly. */
- if (full_write (STDOUT_FILENO, bp, to_write) != to_write
- && ! ignorable (errno))
+ if (full_write (STDOUT_FILENO, bp, to_write) != to_write)
error (EXIT_FAILURE, errno, "%s", _("write error"));
}
else if (! k)
@@ -776,7 +775,12 @@ ofile_open (of_t *files, size_t i_check, size_t nfiles)
In specialised cases the consumer can keep reading
from the fifo, terminating on conditions in the data
itself, or perhaps never in the case of `tail -f`.
- I.E. for fifos it is valid to attempt this reopen. */
+ I.E. for fifos it is valid to attempt this reopen.
+
+ We don't handle the filter_command case here, as create()
+ will exit if there are not enough files in that case.
+ I.E. we don't support restarting filters, as that would
+ put too much burden on users specifying --filter commands. */
fd = open (files[i_check].of_name,
O_WRONLY | O_BINARY | O_APPEND | O_NONBLOCK);
}
@@ -798,7 +802,7 @@ ofile_open (of_t *files, size_t i_check, size_t nfiles)
error (EXIT_FAILURE, errno, "%s", files[i_check].of_name);
}
- if (fclose (files[i_reopen].ofile) != 0 && ! ignorable (errno))
+ if (fclose (files[i_reopen].ofile) != 0)
error (EXIT_FAILURE, errno, "%s", files[i_reopen].of_name);
files[i_reopen].ofile = NULL;
files[i_reopen].ofd = OFD_APPEND;
@@ -882,12 +886,10 @@ lines_rr (uintmax_t k, uintmax_t n, char *buf, size_t bufsize)
{
if (line_no == k && unbuffered)
{
- if (full_write (STDOUT_FILENO, bp, to_write) != to_write
- && ! ignorable (errno))
+ if (full_write (STDOUT_FILENO, bp, to_write) != to_write)
error (EXIT_FAILURE, errno, "%s", _("write error"));
}
- else if (line_no == k && fwrite (bp, to_write, 1, stdout) != 1
- && ! ignorable (errno))
+ else if (line_no == k && fwrite (bp, to_write, 1, stdout) != 1)
{
clearerr (stdout); /* To silence close_stdout(). */
error (EXIT_FAILURE, errno, "%s", _("write error"));
@@ -915,7 +917,7 @@ lines_rr (uintmax_t k, uintmax_t n, char *buf, size_t bufsize)
if (file_limit)
{
- if (fclose (files[i_file].ofile) != 0 && ! ignorable (errno))
+ if (fclose (files[i_file].ofile) != 0)
error (EXIT_FAILURE, errno, "%s", files[i_file].of_name);
files[i_file].ofile = NULL;
files[i_file].ofd = OFD_APPEND;