Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136653663
D10108.id26574.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D10108.id26574.diff
View Options
Index: usr.bin/grep/grep.c
===================================================================
--- usr.bin/grep/grep.c
+++ usr.bin/grep/grep.c
@@ -725,7 +725,7 @@
if ((aargc == 0 || aargc == 1) && !Hflag)
hflag = true;
- if (aargc == 0)
+ if (aargc == 0 && (dirbehave != DIR_RECURSE || patterns == 0))
exit(!procfile("-"));
if (dirbehave == DIR_RECURSE)
Index: usr.bin/grep/util.c
===================================================================
--- usr.bin/grep/util.c
+++ usr.bin/grep/util.c
@@ -111,6 +111,7 @@
FTSENT *p;
int c, fts_flags;
bool ok;
+ char **tdir = NULL;
c = fts_flags = 0;
@@ -128,7 +129,14 @@
fts_flags |= FTS_NOSTAT | FTS_NOCHDIR;
- if (!(fts = fts_open(argv, fts_flags, NULL)))
+ if(argv[0] == NULL) {
+ tdir = grep_malloc(2 * sizeof(char *));
+ if((tdir[0] = getcwd(NULL, 0)) == NULL)
+ err(2, "getcwd");
+ tdir[1] = NULL;
+ }
+
+ if (!(fts = fts_open((tdir != NULL ? tdir : argv), fts_flags, NULL)))
err(2, "fts_open");
while ((p = fts_read(fts)) != NULL) {
switch (p->fts_info) {
@@ -165,6 +173,12 @@
}
fts_close(fts);
+
+ if(tdir != NULL) {
+ free(tdir[0]);
+ free(tdir);
+ }
+
return (c);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 19, 6:30 PM (19 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25663162
Default Alt Text
D10108.id26574.diff (1 KB)
Attached To
Mode
D10108: bsdgrep(1): For -r, use the working directory if no directory is specified
Attached
Detach File
Event Timeline
Log In to Comment