← Commit list

3c3928fc6

Denys Vlasenko
Denys Vlasenko
2020-10-01
SUCCESS Duration: 149s

Subject

tydy up a few uses of recursive_action(), no logic changes

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

debianutils/run_parts.c+4 -4
@@ -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;
findutils/grep.c+7 -6
@@ -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;
}
include/libbb.h+3 -3
@@ -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;