blob: 3ae1ee0697f073d90bbd5f07eb40baef78e25056 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
From 6d777b75ed322ea5ef0d1674ddfee1b5713cb04f Mon Sep 17 00:00:00 2001
From: Aaro Koskinen <aaro.koskinen@iki.fi>
Date: Sat, 24 Oct 2015 22:01:29 +0200
Subject: [PATCH] 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>
---
findutils/xargs.c | 3 +++
1 file changed, 3 insertions(+)
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
{
--
2.10.1
|