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 /tests/misc/sort | |
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 'tests/misc/sort')
-rwxr-xr-x | tests/misc/sort | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/misc/sort b/tests/misc/sort index 5be00a017..5d15d7572 100755 --- a/tests/misc/sort +++ b/tests/misc/sort @@ -33,7 +33,7 @@ my $mb_locale = $ENV{LOCALE_FR_UTF8}; # Normalize each diagnostic to use '-'. my $normalize_filename = {ERR_SUBST => 's/^$prog: .*?:/$prog: -:/'}; -my $no_file = "$prog: open failed: no-file: No such file or directory\n"; +my $no_file = "$prog: cannot read: no-file: No such file or directory\n"; my @Tests = ( |