diff options
author | Pádraig Brady <P@draigBrady.com> | 2012-07-01 01:14:42 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2012-07-02 21:14:29 +0200 |
commit | 44fbd3fd862e34d42006f8b74cb11c9c56346417 (patch) | |
tree | 2455d37347b3e504d30c33c607cd1f096c9c51c5 /HACKING | |
parent | 8285c2aca0ee81ca2ce0507084259de8384e809f (diff) | |
download | coreutils-44fbd3fd862e34d42006f8b74cb11c9c56346417.tar.xz |
sort: avoid redundant processing with inaccessible inputs or output
* src/sort.c (check_inputs): A new function to verify all inputs
are accessible before further processing.
(check_output): A new function to open or create a specified
output file, before futher processing.
(stream_open): Adjust to truncating the previously opened
output file rather than opening directly.
(avoid_trashing_input): Optimize to stat the output file
descriptor, rather than the file name.
(main): Call the new functions to check accessibility of
inputs and output, before processing starts.
* tests/misc/sort: Adjust to the changed error message.
* tests/misc/sort-merge-fdlimit: Account for the earlier opened
file descriptor of the specified output file.
* tests/misc/sort-exit-early: A new test to exercise the improvements.
* tests/Makefile.am: Reference the new test.
* NEWS: Mention the improvement.
Suggested-by: Bernhard Voelker
Diffstat (limited to 'HACKING')
0 files changed, 0 insertions, 0 deletions