summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debianutils/run_parts.c8
-rw-r--r--findutils/grep.c13
-rw-r--r--include/libbb.h6
3 files changed, 14 insertions, 13 deletions
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index c80cc86..196e064 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -133,10 +133,10 @@ static int bb_alphasort(const void *p1, const void *p2)
static int FAST_FUNC act(const char *file, struct stat *statbuf, void *args UNUSED_PARAM, int depth)
{
- if (depth == 1)
+ if (depth == 0)
return TRUE;
- if (depth == 2
+ if (depth == 1
&& ( !(statbuf->st_mode & (S_IFREG | S_IFLNK))
|| invalid_name(file)
|| (!(option_mask32 & OPT_l) && access(file, X_OK) != 0))
@@ -200,8 +200,8 @@ int run_parts_main(int argc UNUSED_PARAM, char **argv)
act, /* file action */
act, /* dir action */
NULL, /* user data */
- 1 /* depth */
- );
+ 0 /* depth */
+ );
if (!names)
return 0;
diff --git a/findutils/grep.c b/findutils/grep.c
index b456ed4..0892a71 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -694,15 +694,16 @@ static int FAST_FUNC file_action_grep(const char *filename,
static int grep_dir(const char *dir)
{
int matched = 0;
- recursive_action(dir,
- /* recurse=yes */ ACTION_RECURSE |
- /* followLinks=always */ ((option_mask32 & OPT_R) ? ACTION_FOLLOWLINKS : 0) |
- /* followLinks=command line only */ ACTION_FOLLOWLINKS_L0 |
- /* depthFirst=yes */ ACTION_DEPTHFIRST,
+ recursive_action(dir, 0
+ | ACTION_RECURSE
+ | ((option_mask32 & OPT_R) ? ACTION_FOLLOWLINKS : 0)
+ | ACTION_FOLLOWLINKS_L0 /* grep -r ... SYMLINK follows it */
+ | ACTION_DEPTHFIRST
+ | 0,
/* fileAction= */ file_action_grep,
/* dirAction= */ NULL,
/* userData= */ &matched,
- /* depth= */ 0);
+ 0);
return matched;
}
diff --git a/include/libbb.h b/include/libbb.h
index 3e23b5b..8b84d13 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -437,15 +437,15 @@ enum {
ACTION_FOLLOWLINKS = (1 << 1),
ACTION_FOLLOWLINKS_L0 = (1 << 2),
ACTION_DEPTHFIRST = (1 << 3),
- /*ACTION_REVERSE = (1 << 4), - unused */
- ACTION_QUIET = (1 << 5),
- ACTION_DANGLING_OK = (1 << 6),
+ ACTION_QUIET = (1 << 4),
+ ACTION_DANGLING_OK = (1 << 5),
};
typedef uint8_t recurse_flags_t;
extern int recursive_action(const char *fileName, unsigned flags,
int FAST_FUNC (*fileAction)(const char *fileName, struct stat* statbuf, void* userData, int depth),
int FAST_FUNC (*dirAction)(const char *fileName, struct stat* statbuf, void* userData, int depth),
void* userData, unsigned depth) FAST_FUNC;
+
extern int device_open(const char *device, int mode) FAST_FUNC;
enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */
extern int xgetpty(char *line) FAST_FUNC;