Skip to content

Commit

Permalink
Attempt miekg#2 for backwards compat
Browse files Browse the repository at this point in the history
  • Loading branch information
miekg committed Mar 21, 2013
1 parent 8034b12 commit b71c0a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions unbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ struct ub_result *new_ub_result() {
r = calloc(sizeof(struct ub_result), 1);
return r;
}
int ub_ttl(struct ub_result *r) {
char *p;
p = (char*)r + sizeof(struct ub_result) - sizeof(int);
return (int)*p;
}
*/
import "C"

Expand Down Expand Up @@ -222,7 +227,7 @@ func (u *Unbound) Resolve(name string, rrtype, rrclass uint16) (*Result, error)
r.Bogus = res.bogus == 1
r.WhyBogus = C.GoString(res.why_bogus)
if u.haveTtl() {
r.Ttl = uint32(res.ttl)
r.Ttl = uint32(C.ub_ttl(res))
}

// Re-create the RRs
Expand Down Expand Up @@ -356,4 +361,3 @@ func (u *Unbound) Version() (version [3]int) {
version[2], _ = strconv.Atoi(v[2])
return
}

0 comments on commit b71c0a8

Please sign in to comment.