summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
authorBo Borgerson <gigabo@gmail.com>2008-06-19 15:37:21 -0400
committerJim Meyering <meyering@redhat.com>2008-06-20 08:47:28 +0200
commit02bfd65480a24760e49a3cd85d38e8802ea264a5 (patch)
treeb480b47168888af0bb85dc42456c62c4c536b673 /src/sort.c
parent2c88abe2a2a5579cb1673af5f6a28204305a45f5 (diff)
downloadcoreutils-02bfd65480a24760e49a3cd85d38e8802ea264a5.tar.xz
sort: Fix bug where --batch-size option shrank SORT_SIZE.
* src/sort.c (specify_nmerge, main): Only adjust SORT_SIZE if it's already set. * tests/misc/sort-merge: Test bug fix.
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/sort.c b/src/sort.c
index 13935218a..2039dabf8 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1105,14 +1105,7 @@ specify_nmerge (int oi, char c, char const *s)
e = LONGINT_OVERFLOW;
}
else
- {
- /* Need to re-check that we meet the minimum
- requirement for memory usage with the new,
- potentially larger, nmerge. */
- sort_size = MAX (sort_size, MIN_SORT_SIZE);
-
- return;
- }
+ return;
}
}
@@ -3320,6 +3313,11 @@ main (int argc, char **argv)
files = &minus;
}
+ /* Need to re-check that we meet the minimum requirement for memory
+ usage with the final value for NMERGE. */
+ if (0 < sort_size)
+ sort_size = MAX (sort_size, MIN_SORT_SIZE);
+
if (checkonly)
{
if (nfiles > 1)