summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-12-12 15:01:39 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-12-12 15:01:39 +0000
commitb3b6928811134680804c01b70dc67d170023625f (patch)
tree91b0b7739aa20fb8c83e72f1df6b003634fd3d9a
parent97b1d9934463ae2e43bf6efc64a1574a60af3535 (diff)
downloads6-dns-b3b6928811134680804c01b70dc67d170023625f.tar.xz
Steps to debug the s6-dnsname-filter segfault
-rw-r--r--src/clients/s6-dnsname-filter.c4
-rw-r--r--src/clients/s6dns_generic_filter_main.c7
2 files changed, 5 insertions, 6 deletions
diff --git a/src/clients/s6-dnsname-filter.c b/src/clients/s6-dnsname-filter.c
index 6522003..99dad32 100644
--- a/src/clients/s6-dnsname-filter.c
+++ b/src/clients/s6-dnsname-filter.c
@@ -12,7 +12,7 @@
#define USAGE "s6-dnsname-filter [ -4 ] [ -6 ] [ -l lines ] [ -c concurrency ] [ -t timeout ] [ -f format ] [ -e errorformat ]"
-static unsigned int ipscanner (s6dns_domain_t_ref d, char const *s)
+static unsigned int ipscanner (s6dns_domain_t *d, char const *s)
{
char ip[16] ;
register unsigned int pos ;
@@ -34,7 +34,7 @@ static unsigned int ipscanner (s6dns_domain_t_ref d, char const *s)
goto yes ;
}
}
- return 0 ;
+ return (errno = 0, 0) ;
yes:
if (!s6dns_domain_encode(d)) return 0 ;
return pos ;
diff --git a/src/clients/s6dns_generic_filter_main.c b/src/clients/s6dns_generic_filter_main.c
index 79260bd..664edef 100644
--- a/src/clients/s6dns_generic_filter_main.c
+++ b/src/clients/s6dns_generic_filter_main.c
@@ -33,7 +33,7 @@ struct line_s
#define LINE_ZERO { .swrd = STRALLOC_ZERO, .wpos = 0, .dpos = 0, .w = "\0", .pending = 0 }
-static void line_recycle (line_t_ref l)
+static void line_recycle (line_t *l)
{
l->swrd.len = 0 ;
l->pending = 0 ;
@@ -89,7 +89,6 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co
uint16 lhead = 0, ltail = 0, numlines = 0, pending = 0 ;
line_t storage[maxlines+1] ;
uint16 lineindex[maxconn] ;
- x[2].fd = skadns_fd(&a) ;
{
line_t line_zero = LINE_ZERO ;
char const *args[4] = { "", "", "", "" } ;
@@ -165,11 +164,13 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co
if (error_isagain(errno)) break ;
if (errno != EPIPE) strerr_diefu1sys(111, "read from stdin") ;
if (!stralloc_catb(&line->swrd, "\n", 1)) strerr_diefu1sys(111, "stralloc_catb") ;
+ fd_close(x[0].fd) ;
x[0].fd = -1 ;
break ;
}
else if (!r)
{
+ fd_close(x[0].fd) ;
x[0].fd = -1 ;
break ;
}
@@ -202,8 +203,6 @@ int s6dns_generic_filter_main (int argc, char const *const *argv, char const *co
}
}
- if (x[0].revents & IOPAUSE_EXCEPT) x[0].fd = -1 ;
-
/* Send processed lines to stdout */