Merge lp:~jamesodhunt/libnih/nih_io_select_fds-check-limits into lp:libnih

Proposed by James Hunt on 2011-08-26
Status: Merged
Approved by: Scott James Remnant on 2011-08-26
Approved revision: 1050
Merged at revision: 1052
Proposed branch: lp:~jamesodhunt/libnih/nih_io_select_fds-check-limits
Merge into: lp:libnih
Diff against target: 34 lines (+9/-0)
2 files modified
ChangeLog (+5/-0)
nih/io.c (+4/-0)
To merge this branch: bzr merge lp:~jamesodhunt/libnih/nih_io_select_fds-check-limits
Reviewer Review Type Date Requested Status
Scott James Remnant 2011-08-26 Approve on 2011-08-26
Review via email: mp+73080@code.launchpad.net

Description of the change

  * nih/io.c (nih_io_select_fds): Ensure number of fds being managed
    is within limits.

To post a comment you must log in.
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2011-06-20 18:47:02 +0000
3+++ ChangeLog 2011-08-26 16:39:33 +0000
4@@ -1,3 +1,8 @@
5+2011-08-26 James Hunt <james.hunt@ubuntu.com>
6+
7+ * nih/io.c (nih_io_select_fds): Ensure number of fds being managed
8+ is within limits.
9+
10 2011-06-20 James Hunt <james.hunt@ubuntu.com>
11
12 * nih/watch.c (nih_watch_handle): Handle non-directory watches;
13
14=== modified file 'nih/io.c'
15--- nih/io.c 2009-08-03 23:29:41 +0000
16+++ nih/io.c 2011-08-26 16:39:33 +0000
17@@ -165,6 +165,7 @@
18 nih_assert (readfds != NULL);
19 nih_assert (writefds != NULL);
20 nih_assert (exceptfds != NULL);
21+ nih_assert (*nfds <= FD_SETSIZE);
22
23 nih_io_init ();
24
25@@ -186,6 +187,9 @@
26 *nfds = nih_max (*nfds, watch->fd + 1);
27 }
28 }
29+
30+ /* Re-check in case we exceeded the limit in the loop */
31+ nih_assert (*nfds <= FD_SETSIZE);
32 }
33
34 /**

Subscribers

People subscribed via source and target branches