summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorian <ian>2000-09-16 21:48:13 +0000
committerian <ian>2000-09-16 21:48:13 +0000
commit67a57aae0e981c235a2cb8d27214a3d4213ff941 (patch)
treed980169c47fc10a62e8738e0101ebce1ddf827d9 /client
parent98e3fa813e15297eaa1c9858aa962d08d52c92cd (diff)
+ * Regression tests now include adnshost, adnslogres, adnsresfilter.
@@ -9,7 +9,7 @@ * adnshost, adnslogres, adnsresfilter have options for config override. * adnsresfilter has --debug option. * Improvements to adnslogres (incl. new -c option) from Tony Finch. - * Regression tests now include `adnshost' invocations. + * Regression tests now include adnshost, adnslogres, adnsresfilter. * Test cancellation both before and after query completion. Portability fixes:
Diffstat (limited to 'client')
-rw-r--r--client/adnslogres.c21
-rw-r--r--client/adnsresfilter.c4
2 files changed, 14 insertions, 11 deletions
diff --git a/client/adnslogres.c b/client/adnslogres.c
index fc6b2cd..c1a22c0 100644
--- a/client/adnslogres.c
+++ b/client/adnslogres.c
@@ -47,6 +47,10 @@ static const char * const cvsid =
#include "config.h"
#include "adns.h"
+#ifdef ADNS_REGRESS_TEST
+# include "hredirect.h"
+#endif
+
/* maximum number of concurrent DNS queries */
#define MAXMAXPENDING 64000
#define DEFMAXPENDING 2000
@@ -58,7 +62,7 @@ static const char * const cvsid =
#define OPT_DEBUG 1
#define OPT_POLL 2
-static const char *progname;
+static const char *const progname= "adnslogres";
static const char *config_text;
#define guard_null(str) ((str) ? (str) : "")
@@ -180,7 +184,7 @@ static void proclog(FILE *inf, FILE *outf, int maxpending, int opts) {
if (opts & OPT_DEBUG)
msg("%d in queue; checking %.*s", len,
head->rest-head->addr, guard_null(head->addr));
- if (eof || len > maxpending) {
+ if (eof || len >= maxpending) {
if (opts & OPT_POLL)
err= adns_wait_poll(adns, &head->query, &answer, NULL);
else
@@ -189,10 +193,15 @@ static void proclog(FILE *inf, FILE *outf, int maxpending, int opts) {
err= adns_check(adns, &head->query, &answer, NULL);
}
if (err == EAGAIN) break;
+ if (err) {
+ fprintf(stderr, "%s: adns_wait/check: %s", progname, strerror(err));
+ exit(1);
+ }
printline(outf, head->start, head->addr, head->rest,
answer->status == adns_s_ok ? *answer->rrs.str : NULL);
line= head; head= head->next;
- free(line); free(answer);
+ free(line);
+ free(answer);
len--;
}
if (!eof) {
@@ -220,12 +229,6 @@ int main(int argc, char *argv[]) {
extern char *optarg;
FILE *inf;
- progname= strrchr(*argv, '/');
- if (progname)
- progname++;
- else
- progname= *argv;
-
maxpending= DEFMAXPENDING;
opts= 0;
while ((c= getopt(argc, argv, "c:C:dp")) != -1)
diff --git a/client/adnsresfilter.c b/client/adnsresfilter.c
index 02d0f4c..82aac84 100644
--- a/client/adnsresfilter.c
+++ b/client/adnsresfilter.c
@@ -127,6 +127,7 @@ static void usage(void) {
"Timeout is the maximum amount to delay any particular bit of output for.\n"
"Lookups will go on in the background. Default timeout = 1000 (ms).\n")
== EOF) outputerr();
+ if (fflush(stdout)) sysfail("flush stdout");
}
static void usageerr(const char *why) NONRETURNING;
@@ -467,7 +468,6 @@ int main(int argc, const char *const *argv) {
}
if (nonblock(0,0)) sysfail("un-nonblock stdin");
if (nonblock(1,0)) sysfail("un-nonblock stdout");
- if (ferror(stdin) || fclose(stdin)) sysfail("read stdin");
- if (fclose(stdout)) sysfail("close stdout");
+ adns_finish(ads);
exit(0);
}