taxonomy: add timeout & disable stdio buffer.
Make sure the process exits after 30 seconds, not hangs forever.
Change-Id: Ic5fe6b67a23c4f28de45854bdc694a96600f51f5
diff --git a/cmds/asustax.cc b/cmds/asustax.cc
index edbcd4f..d4c665f 100644
--- a/cmds/asustax.cc
+++ b/cmds/asustax.cc
@@ -210,6 +210,9 @@
int s, opt, i;
const char *ifname = "br0";
+ setlinebuf(stdout);
+ alarm(30);
+
while ((opt = getopt(argc, argv, "i:")) != -1) {
switch (opt) {
case 'i':
diff --git a/cmds/dhcpvendortax.c b/cmds/dhcpvendortax.c
index a3d4b9d..ee0ca24 100644
--- a/cmds/dhcpvendortax.c
+++ b/cmds/dhcpvendortax.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
struct string_match {
@@ -391,6 +392,8 @@
const char *vendor = NULL;
char species[80];
+ setlinebuf(stdout);
+ alarm(30);
while ((c = getopt_long(argc, argv, "l:v:", long_options, NULL)) != -1) {
switch (c) {
case 'l':
diff --git a/cmds/ssdptax.cc b/cmds/ssdptax.cc
index d218c0a..1c99553 100644
--- a/cmds/ssdptax.cc
+++ b/cmds/ssdptax.cc
@@ -348,6 +348,8 @@
int testmode = 0;
setlinebuf(stdout);
+ alarm(30);
+
if (curl_global_init(CURL_GLOBAL_NOTHING)) {
fprintf(stderr, "curl_global_init failed\n");
exit(1);