struct epoll_event ev = { .events = EPOLLIN };
epollfd = epoll_create1(0);
+ if (epollfd < 0) {
+ printf("epoll_create failed: %m");
+ return;
+ }
for (nfds = 0; nfds < fd_count; ++nfds) {
int fd = data_fds[nfds]->fd;
ev.data.ptr = data_fds[nfds];
if (fd_set_flags(fd, O_NONBLOCK) < 0)
- return;
+ goto cleanup;
if (data_fds[nfds]->ops != &ops_binfile) { // HACK
if (data_fds[nfds]->log_len != 0) {
/* can't rely on the regular log_len-based removal path
logs->timeout = 0;
flush_logs(logs, l_file);
+
+cleanup:
+ close(epollfd);
}
int parse_options(int argc, char **argv, struct log_file *l_file, struct sort_vector *logs, int *enabled_buffers, list_head *file_input_names, action_e *action, int *dump, list_head *filters)