bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/9] Fix compiler warnings in lib/fdleak.c


From: James Youngman
Subject: [PATCH 4/9] Fix compiler warnings in lib/fdleak.c
Date: Sat, 4 Jun 2011 01:21:48 +0100

* lib/fdleak.c (visit_open_fds): Rename loop variable from i to j
to avoid shadowing.
(get_proc_max_fd): Fix definition (it's a void function, not a
traditional pre-ANSI function definition).
---
 ChangeLog    |    6 ++++++
 lib/fdleak.c |   10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f84b5c7..bba9198 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-06-03  James Youngman  <address@hidden>
 
+       Fix compiler warnings in lib/fdleak.c
+       * lib/fdleak.c (visit_open_fds): Rename loop variable from i to j
+       to avoid shadowing.
+       (get_proc_max_fd): Fix definition (it's a void function, not a
+       traditional pre-ANSI function definition).
+
        Fix several small compiler warnings.
        * lib/dircallback.c: Include dircallback.h.
        * lib/dircallback.h: Correct declaration of run_in_dir.
diff --git a/lib/fdleak.c b/lib/fdleak.c
index ac8d8b0..c94275b 100644
--- a/lib/fdleak.c
+++ b/lib/fdleak.c
@@ -66,7 +66,7 @@ static size_t num_cloexec_fds;
 /* Determine the value of the largest open fd, on systems that
  * offer /proc/self/fd. */
 static int
-get_proc_max_fd ()
+get_proc_max_fd (void)
 {
   const char *path = "/proc/self/fd";
   int maxfd = -1;
@@ -160,12 +160,12 @@ visit_open_fds (int fd_min, int fd_max,
        }
       else
        {
-         int i;
-         for (i=0; i<limit; i++)
+         int j;
+         for (j=0; j<limit; j++)
            {
-             if (pf[i].revents != POLLNVAL)
+             if (pf[j].revents != POLLNVAL)
                {
-                 if (0 != (rv = callback (pf[i].fd, cb_context)))
+                 if (0 != (rv = callback (pf[j].fd, cb_context)))
                    return rv;
                }
            }
-- 
1.7.2.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]