[git commit] xargs: make -I imply -r
Denys Vlasenko
vda.linux at googlemail.com
Sat Oct 24 20:01:29 UTC 2015
commit: http://git.busybox.net/busybox/commit/?id=6d777b75ed322ea5ef0d1674ddfee1b5713cb04f
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master
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 at iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
findutils/xargs.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 5870b8a..69f83b1 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -577,6 +577,9 @@ int xargs_main(int argc, char **argv)
G.argv = argv;
argc = 0;
read_args = process_stdin_with_replace;
+ /* Make -I imply -r. GNU findutils seems to do the same: */
+ /* (otherwise "echo -n | xargs -I% echo %" would SEGV) */
+ opt |= OPT_NO_EMPTY;
} else
#endif
{
More information about the busybox-cvs
mailing list