aboutsummaryrefslogtreecommitdiff
path: root/io/fts.c
diff options
context:
space:
mode:
Diffstat (limited to 'io/fts.c')
-rw-r--r--io/fts.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/io/fts.c b/io/fts.c
index 75bba1f..4c57084 100644
--- a/io/fts.c
+++ b/io/fts.c
@@ -74,7 +74,7 @@ static u_short fts_stat __P((FTS *, struct dirent *, FTSENT *, int))
_a > _b ? _a : _b; })
#endif
-#define ISDOT(a) (a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
+#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
#define ISSET(opt) (sp->fts_options & opt)
#define SET(opt) (sp->fts_options |= opt)
@@ -326,7 +326,7 @@ fts_read(sp)
if (p->fts_info == FTS_D) {
/* If skipped or crossed mount point, do post-order visit. */
if (instr == FTS_SKIP ||
- ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
+ (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
if (p->fts_flags & FTS_SYMFOLLOW)
(void)__close(p->fts_symfd);
if (sp->fts_child) {
@@ -376,7 +376,7 @@ fts_read(sp)
/* Move to the next node on this level. */
next: tmp = p;
- if (p = p->fts_link) {
+ if ((p = p->fts_link)) {
free(tmp);
/*
@@ -674,7 +674,9 @@ fts_build(sp, type)
/* Read the directory, attaching each entry to the `link' pointer. */
adjaddr = NULL;
- for (head = tail = NULL, nitems = 0; dp = __readdir(dirp);) {
+ head = tail = NULL;
+ nitems = 0;
+ while((dp = __readdir(dirp))) {
int namlen;
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
@@ -717,8 +719,8 @@ mem1: saved_errno = errno;
p->fts_accpath = cur->fts_accpath;
} else if (nlinks == 0
#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
- || nlinks > 0 &&
- dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN
+ || (nlinks > 0 &&
+ dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
#endif
) {
p->fts_accpath =
@@ -964,7 +966,7 @@ fts_lfree(head)
register FTSENT *p;
/* Free a linked list of structures. */
- while (p = head) {
+ while ((p = head)) {
head = head->fts_link;
free(p);
}