]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Tiny refactoring in fts to eliminate a warning.
authorRoland McGrath <roland@hack.frob.com>
Mon, 20 Oct 2014 22:32:26 +0000 (15:32 -0700)
committerRoland McGrath <roland@hack.frob.com>
Mon, 20 Oct 2014 22:32:45 +0000 (15:32 -0700)
ChangeLog
io/fts.c

index f6a03715da8d7df30d2441f6ecdbd45f903ed31e..962e730d5d9353a0bfd88c1e36e3bb08e706ce91 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-10-20  Roland McGrath  <roland@hack.frob.com>
+
+       * io/fts.c (dirent_not_directory): New function.
+       (fts_build): Call it.
+
 2014-10-20  Roland McGrath  <roland@hack.frob.com>
 
        * nptl/version.c (__nptl_main): Use normal __write rather than
index c9c054d6d36ab20f3d575bed9b1ab86b0aa0dc4a..46cbb725713cb1cd527b635753ff1bdf72149f30 100644 (file)
--- a/io/fts.c
+++ b/io/fts.c
@@ -561,6 +561,16 @@ fts_children(sp, instr)
        return (sp->fts_child);
 }
 
+static inline int
+dirent_not_directory(const struct dirent *dp)
+{
+#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
+        return dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN;
+#else
+        return 0;
+#endif
+}
+
 /*
  * This is the tricky part -- do not casually change *anything* in here.  The
  * idea is to build the linked list of entries that are used by fts_children
@@ -759,11 +769,7 @@ mem1:                              saved_errno = errno;
                                p->fts_info = FTS_NSOK;
                        p->fts_accpath = cur->fts_accpath;
                } else if (nlinks == 0
-#if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE
-                          || (nostat &&
-                              dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN)
-#endif
-                   ) {
+                           || (nostat && dirent_not_directory(dp))) {
                        p->fts_accpath =
                            ISSET(FTS_NOCHDIR) ? p->fts_path : p->fts_name;
                        p->fts_info = FTS_NSOK;