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>
This commit is contained in:
Aaro Koskinen 2015-10-24 22:01:29 +02:00 committed by Denys Vlasenko
parent f98705a00c
commit 6d777b75ed

View File

@ -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
{