bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23716: [PATCH 5/6] grep: remove unnecessary dirdesc variable.


From: Zev Weiss
Subject: bug#23716: [PATCH 5/6] grep: remove unnecessary dirdesc variable.
Date: Tue, 7 Jun 2016 01:37:42 -0500

* src/grep.c (grepdirent): Remove dirdesc variable and just use
fts_cwd_fd directly, since the fts_options test was guaranteed to
succeed (and fts_cwd_fd was already being used directly in fstatat()
anyway).
---
 src/grep.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/grep.c b/src/grep.c
index eadc2be..d01bc4f 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1552,7 +1552,6 @@ static bool
 grepdirent (FTS *fts, FTSENT *ent, bool command_line)
 {
   bool follow;
-  int dirdesc;
   command_line &= ent->fts_level == FTS_ROOTLEVEL;
 
   if (ent->fts_info == FTS_DP)
@@ -1636,10 +1635,7 @@ grepdirent (FTS *fts, FTSENT *ent, bool command_line)
       abort ();
     }
 
-  dirdesc = ((fts->fts_options & (FTS_NOCHDIR | FTS_CWDFD)) == FTS_CWDFD
-             ? fts->fts_cwd_fd
-             : AT_FDCWD);
-  return grepfile (dirdesc, ent->fts_accpath, follow, command_line);
+  return grepfile (fts->fts_cwd_fd, ent->fts_accpath, follow, command_line);
 }
 
 /* True if errno is ERR after 'open ("symlink", ... O_NOFOLLOW ...)'.
-- 
2.8.0.rc3






reply via email to

[Prev in Thread] Current Thread [Next in Thread]