summaryrefslogtreecommitdiff
path: root/tests/misc/sort-merge-fdlimit
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2012-07-01 01:14:42 +0100
committerPádraig Brady <P@draigBrady.com>2012-07-02 21:14:29 +0200
commit44fbd3fd862e34d42006f8b74cb11c9c56346417 (patch)
tree2455d37347b3e504d30c33c607cd1f096c9c51c5 /tests/misc/sort-merge-fdlimit
parent8285c2aca0ee81ca2ce0507084259de8384e809f (diff)
downloadcoreutils-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-merge-fdlimit')
-rwxr-xr-xtests/misc/sort-merge-fdlimit2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/misc/sort-merge-fdlimit b/tests/misc/sort-merge-fdlimit
index 7ce109c1a..ee1575aed 100755
--- a/tests/misc/sort-merge-fdlimit
+++ b/tests/misc/sort-merge-fdlimit
@@ -65,7 +65,7 @@ done
(seq 6 && echo 6) >exp || fail=1
echo 6 >out || fail=1
(exec 3<&- 4<&- 5<&- 6</dev/null 7<&6 8<&6 9<&6 &&
- ulimit -n 10 &&
+ ulimit -n 11 &&
sort -n -m --batch-size=7 -o out out in/1 in/2 in/3 in/4 in/5 out
) &&
compare exp out || fail=1