diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2015-10-24 22:01:29 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-10-24 22:01:29 +0200 |
commit | 6d777b75ed322ea5ef0d1674ddfee1b5713cb04f (patch) | |
tree | 98261f2e1093b22a80d52a30a0bf34afef40e0a1 | |
parent | f98705a00c15fc029116e00507abcfb745b86bfa (diff) | |
download | busybox-w32-6d777b75ed322ea5ef0d1674ddfee1b5713cb04f.tar.gz busybox-w32-6d777b75ed322ea5ef0d1674ddfee1b5713cb04f.tar.bz2 busybox-w32-6d777b75ed322ea5ef0d1674ddfee1b5713cb04f.zip |
xargs: make -I imply -r
Make -I imply -r (GNU findutils seems to do the same).
Fixes the following bug:
$ echo -n | xargs -I% echo %
Segmentation fault
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | findutils/xargs.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/findutils/xargs.c b/findutils/xargs.c index 5870b8a16..69f83b128 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -577,6 +577,9 @@ int xargs_main(int argc, char **argv) | |||
577 | G.argv = argv; | 577 | G.argv = argv; |
578 | argc = 0; | 578 | argc = 0; |
579 | read_args = process_stdin_with_replace; | 579 | read_args = process_stdin_with_replace; |
580 | /* Make -I imply -r. GNU findutils seems to do the same: */ | ||
581 | /* (otherwise "echo -n | xargs -I% echo %" would SEGV) */ | ||
582 | opt |= OPT_NO_EMPTY; | ||
580 | } else | 583 | } else |
581 | #endif | 584 | #endif |
582 | { | 585 | { |