aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--findutils/xargs.c2
-rwxr-xr-xtestsuite/xargs.tests11
2 files changed, 12 insertions, 1 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 4fb306bb8..ff04bfe7c 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -315,6 +315,7 @@ static char* FAST_FUNC process_stdin(int n_max_chars, int n_max_arg, char *buf)
315 } 315 }
316 } 316 }
317 if (state == SPACE) { /* word's delimiter or EOF detected */ 317 if (state == SPACE) { /* word's delimiter or EOF detected */
318 state = NORM;
318 if (q) { 319 if (q) {
319 bb_error_msg_and_die("unmatched %s quote", 320 bb_error_msg_and_die("unmatched %s quote",
320 q == '\'' ? "single" : "double"); 321 q == '\'' ? "single" : "double");
@@ -335,7 +336,6 @@ static char* FAST_FUNC process_stdin(int n_max_chars, int n_max_arg, char *buf)
335 if (n_max_arg == 0) { 336 if (n_max_arg == 0) {
336 goto ret; 337 goto ret;
337 } 338 }
338 state = NORM;
339 } 339 }
340 if (p == buf) { 340 if (p == buf) {
341 goto ret; 341 goto ret;
diff --git a/testsuite/xargs.tests b/testsuite/xargs.tests
index 855b33bc2..159f1ff69 100755
--- a/testsuite/xargs.tests
+++ b/testsuite/xargs.tests
@@ -48,6 +48,17 @@ testing "xargs argument line too long" \
48 "seq 10000 99999 | sed -e 's/^/\"/' -e 's/$/\"/' | xargs echo | grep -o 99999; echo \$?" \ 48 "seq 10000 99999 | sed -e 's/^/\"/' -e 's/$/\"/' | xargs echo | grep -o 99999; echo \$?" \
49 "99999\n0\n" \ 49 "99999\n0\n" \
50 "" "" 50 "" ""
51
52testing "xargs -n1" \
53 "xargs -n1 echo" \
54 "1\n2\n3\n4\n5\n" \
55 "" "1 2 3 4 5\n"
56
57testing "xargs -n2" \
58 "xargs -n2 echo" \
59 "1 2\n3 4\n5\n" \
60 "" "1 2 3 4 5\n"
61
51SKIP= 62SKIP=
52 63
53exit $FAILCOUNT 64exit $FAILCOUNT