mirror of
https://github.com/darlinghq/darling-libkqueue.git
synced 2024-10-07 09:13:21 +00:00
prevent descriptor leak
git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@186 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
This commit is contained in:
parent
20ca86b012
commit
c61853cbc3
@ -282,7 +282,7 @@ test_evfilt_read(int _kqfd)
|
||||
{
|
||||
/* Create a connected pair of full-duplex sockets for testing socket events */
|
||||
if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd) < 0)
|
||||
abort();
|
||||
err(1, "socketpair");
|
||||
|
||||
kqfd = _kqfd;
|
||||
test(kevent_socket_add);
|
||||
@ -296,4 +296,6 @@ test_evfilt_read(int _kqfd)
|
||||
test(kevent_socket_dispatch);
|
||||
#endif
|
||||
test(kevent_socket_eof);
|
||||
close(sockfd[0]);
|
||||
close(sockfd[1]);
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ error_handler(int signum)
|
||||
{
|
||||
void *buf[32];
|
||||
|
||||
/* FIXME: the symbols aren't printing */
|
||||
printf("***** ERROR: Program received signal %d *****\n", signum);
|
||||
backtrace_symbols_fd(buf, sizeof(buf) / sizeof(void *), 2);
|
||||
exit(1);
|
||||
@ -74,6 +75,7 @@ testing_begin(void)
|
||||
atexit(testing_atexit);
|
||||
|
||||
/* Install a signal handler for crashes and hangs */
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.sa_handler = error_handler;
|
||||
sigemptyset(&sa.sa_mask);
|
||||
sigaction(SIGSEGV, &sa, NULL);
|
||||
|
@ -205,7 +205,7 @@ test_kevent_vnode_disable_and_enable(void)
|
||||
/* Re-enable and check again */
|
||||
kev.flags = EV_ENABLE;
|
||||
if (kevent(kqfd, &kev, 1, NULL, 0, NULL) < 0)
|
||||
err(1, "%s", test_id);
|
||||
err(1, "kevent");
|
||||
testfile_touch();
|
||||
nfds = kevent(kqfd, NULL, 0, &kev, 1, NULL);
|
||||
if (nfds < 1)
|
||||
@ -242,7 +242,6 @@ test_kevent_vnode_dispatch(void)
|
||||
test_id, (unsigned int)kev.ident, kev.filter, kev.flags);
|
||||
|
||||
/* Confirm that the watch is disabled automatically */
|
||||
puts("-- checking that watch is disabled");
|
||||
testfile_touch();
|
||||
test_no_kevents(kqfd);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user