From 44fbd3fd862e34d42006f8b74cb11c9c56346417 Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Sun, 1 Jul 2012 01:14:42 +0100 Subject: 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 --- tests/misc/sort | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/misc/sort') 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 = ( -- cgit v1.2.3-70-g09d2