summaryrefslogtreecommitdiffstats
path: root/src/tsnifd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tsnifd.c')
-rw-r--r--src/tsnifd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/tsnifd.c b/src/tsnifd.c
index 52393d5..f0a50f3 100644
--- a/src/tsnifd.c
+++ b/src/tsnifd.c
@@ -20,6 +20,7 @@
#include "tsnifd.h"
static struct tsnif_handle handle;
+static struct tsnif_np_args np_args;
static int foreground = 0;
static int killed = 0;
@@ -151,6 +152,8 @@ static int get_args(int argc, char **argv)
{
int ret = 0;
+ memset(&np_args, 0x0, sizeof(np_args));
+
while (1) {
int c;
int option_index = 0;
@@ -212,7 +215,7 @@ int main(int argc, char **argv)
if (get_args(argc, argv))
usage();
- err = tsnif_init(&handle, &ops);
+ err = tsnif_init(&handle, &ops, &np_args);
if (err)
return err;
@@ -235,23 +238,20 @@ int main(int argc, char **argv)
while(!killed) {
fd_set rfds;
struct timeval tv = { 1, 0};
- int ts_fd = tsnif_fd(&handle);
+ int max_fd;
- FD_ZERO(&rfds);
- FD_SET(ts_fd, &rfds);
+ max_fd = tsnif_fd(&handle, &rfds);
- err = select(ts_fd + 1, &rfds, NULL, NULL, &tv);
+ err = select(max_fd + 1, &rfds, NULL, NULL, &tv);
if (err == -1) {
perror("select()");
continue;
} else if (!err)
continue;
- if (FD_ISSET(ts_fd, &rfds)) {
- err = tsnif_process(&handle);
- if (err)
- longjmp(env, 2);
- }
+ err = tsnif_process(&handle, &rfds);
+ if (err)
+ longjmp(env, 2);
}
longjmp(env, 2);