aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/posix/cp.c5
-rw-r--r--toys/posix/du.c6
-rw-r--r--toys/posix/find.c2
-rw-r--r--toys/posix/ls.c2
4 files changed, 7 insertions, 8 deletions
diff --git a/toys/posix/cp.c b/toys/posix/cp.c
index df8269f3..803bff85 100644
--- a/toys/posix/cp.c
+++ b/toys/posix/cp.c
@@ -340,9 +340,8 @@ void cp_main(void)
// Skip nonexistent sources
if (rc) {
- int symfollow = DIRTREE_SYMFOLLOW*!!(toys.optflags & (FLAG_H|FLAG_L));
-
- if (errno != EXDEV || !(new = dirtree_start(src, symfollow)))
+ if (errno!=EXDEV ||
+ !(new = dirtree_start(src, toys.optflags&(FLAG_H|FLAG_L))))
perror_msg("bad '%s'", src);
else dirtree_handle_callback(new, TT.callback);
}
diff --git a/toys/posix/du.c b/toys/posix/du.c
index 0dea495c..c72019e2 100644
--- a/toys/posix/du.c
+++ b/toys/posix/du.c
@@ -128,7 +128,7 @@ static int do_du(struct dirtree *node)
if (S_ISDIR(node->st.st_mode)) {
if (!node->again) {
TT.depth++;
- return DIRTREE_COMEAGAIN | (DIRTREE_SYMFOLLOW*!!(toys.optflags & FLAG_L));
+ return DIRTREE_COMEAGAIN|(DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L));
} else TT.depth--;
}
@@ -151,8 +151,8 @@ void du_main(void)
// Loop over command line arguments, recursing through children
for (args = toys.optc ? toys.optargs : noargs; *args; args++)
- dirtree_handle_callback(dirtree_start(*args,
- DIRTREE_SYMFOLLOW*!!(toys.optflags & (FLAG_H|FLAG_L))), do_du);
+ dirtree_handle_callback(dirtree_start(*args, toys.optflags&(FLAG_H|FLAG_L)),
+ do_du);
if (toys.optflags & FLAG_c) print(TT.total*512, 0);
if (CFG_TOYBOX_FREE) seen_inode(TT.inodes, 0);
diff --git a/toys/posix/find.c b/toys/posix/find.c
index 73502b4a..01d29993 100644
--- a/toys/posix/find.c
+++ b/toys/posix/find.c
@@ -184,7 +184,7 @@ static int do_find(struct dirtree *new)
struct double_list *argdata = TT.argdata;
char *s, **ss;
- recurse = DIRTREE_COMEAGAIN|((toys.optflags&FLAG_L) ? DIRTREE_SYMFOLLOW : 0);
+ recurse = DIRTREE_COMEAGAIN|(DIRTREE_SYMFOLLOW*!!(toys.optflags&FLAG_L));
// skip . and .. below topdir, handle -xdev and -depth
if (new) {
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index 3e5d3910..38db9977 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -329,7 +329,7 @@ static void listfiles(int dirfd, struct dirtree *indir)
} else {
// Read directory contents. We dup() the fd because this will close it.
indir->data = dup(dirfd);
- dirtree_recurse(indir, filter, (flags&FLAG_L) ? DIRTREE_SYMFOLLOW : 0);
+ dirtree_recurse(indir, filter, DIRTREE_SYMFOLLOW*!!(flags&FLAG_L));
}
// Copy linked list to array and sort it. Directories go in array because