TextSearch: fix passing search string to grep

Fix proposed by phoudoin.

Fixes #15650.

Change-Id: Ie7177aaa39ff593445506983cb0725b75ca7bc7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2149
Reviewed-by: Jérôme Duval <[email protected]>
This commit is contained in:
X512
2020-01-24 15:23:01 +00:00
committed by Adrien Destugues
parent a309c6eeb2
commit 7740e52c16
+5 -2
View File
@@ -270,7 +270,10 @@ Grepper::_RunnerThread()
if (! fCaseSensitive)
argv[argc++] = "-i";
if (! fRegularExpression)
argv[argc++] = "-F"; // no a regexp: force fixed string,
argv[argc++] = "-F"; // no a regexp: force fixed string,
// Add double dash argument to tell grep
// it's the end of commands options
argv[argc++] = "--";
argv[argc++] = fPattern;
argv[argc] = NULL;
@@ -420,7 +423,7 @@ Grepper::_RunnerThread()
if (strcmp(fileName, currentFileName) != 0) {
fTarget.SendMessage(&message);
strncpy(currentFileName, fileName,
strncpy(currentFileName, fileName,
sizeof(currentFileName));
message.MakeEmpty();