test-fdset.c | test-fdset.c | |||
---|---|---|---|---|
skipping to change at line 129 | skipping to change at line 129 | |||
assert_se(fdset_put(fdset, fd) >= 0); | assert_se(fdset_put(fdset, fd) >= 0); | |||
assert_se(fdset_remove(fdset, fd) >= 0); | assert_se(fdset_remove(fdset, fd) >= 0); | |||
assert_se(!fdset_contains(fdset, fd)); | assert_se(!fdset_contains(fdset, fd)); | |||
fdset_free(fdset); | fdset_free(fdset); | |||
assert_se(fcntl(fd, F_GETFD) >= 0); | assert_se(fcntl(fd, F_GETFD) >= 0); | |||
unlink(name); | unlink(name); | |||
} | } | |||
static void test_fdset_iterate(void) { | ||||
int fd = -1; | ||||
FDSet *fdset = NULL; | ||||
char name[] = "/tmp/test-fdset_iterate.XXXXXX"; | ||||
Iterator i; | ||||
int c = 0; | ||||
int a; | ||||
fd = mkostemp_safe(name, O_RDWR|O_CLOEXEC); | ||||
assert_se(fd >= 0); | ||||
fdset = fdset_new(); | ||||
assert_se(fdset); | ||||
assert_se(fdset_put(fdset, fd) >= 0); | ||||
assert_se(fdset_put(fdset, fd) >= 0); | ||||
assert_se(fdset_put(fdset, fd) >= 0); | ||||
FDSET_FOREACH(a, fdset, i) { | ||||
c++; | ||||
assert_se(a == fd); | ||||
} | ||||
assert_se(c == 1); | ||||
fdset_free(fdset); | ||||
unlink(name); | ||||
} | ||||
int main(int argc, char *argv[]) { | int main(int argc, char *argv[]) { | |||
test_fdset_new_fill(); | test_fdset_new_fill(); | |||
test_fdset_put_dup(); | test_fdset_put_dup(); | |||
test_fdset_cloexec(); | test_fdset_cloexec(); | |||
test_fdset_close_others(); | test_fdset_close_others(); | |||
test_fdset_remove(); | test_fdset_remove(); | |||
test_fdset_iterate(); | ||||
return 0; | return 0; | |||
} | } | |||
End of changes. 2 change blocks. | ||||
0 lines changed or deleted | 29 lines changed or added | |||
This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ |