diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2014-12-25 20:13:15 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2014-12-25 20:13:15 +0000 |
commit | 2be145afdc82e5f0a96d4709a5201816e0218bb1 (patch) | |
tree | 0fa4e6a4542d2a54110f6befc53d69385007098c /usr.sbin/nsd | |
parent | 46891cba1c1ebdbd04fe2b8e0d1e53fdbd1bf3d0 (diff) |
subtraction of two void * is not well defined, plus two void * can be apart
more than an int can hold; ok krw@ deraadt@ and tedu@ (by implication)
Diffstat (limited to 'usr.sbin/nsd')
-rw-r--r-- | usr.sbin/nsd/xfrd-tcp.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/nsd/xfrd-tcp.c b/usr.sbin/nsd/xfrd-tcp.c index a317857afdb..3fec5d34a1e 100644 --- a/usr.sbin/nsd/xfrd-tcp.c +++ b/usr.sbin/nsd/xfrd-tcp.c @@ -30,6 +30,8 @@ xfrd_pipe_cmp(const void* a, const void* b) const struct xfrd_tcp_pipeline* x = (struct xfrd_tcp_pipeline*)a; const struct xfrd_tcp_pipeline* y = (struct xfrd_tcp_pipeline*)b; int r; + if(x == y) + return 0; if(y->ip_len != x->ip_len) return (int)y->ip_len - (int)x->ip_len; r = memcmp(&x->ip, &y->ip, x->ip_len); @@ -40,7 +42,7 @@ xfrd_pipe_cmp(const void* a, const void* b) if(x->num_unused != y->num_unused) return x->num_unused - y->num_unused; /* different pipelines are different still, even with same numunused*/ - return (int)(a - b); + return (uintptr_t)x < (uintptr_t)y ? -1 : 1; } xfrd_tcp_set_t* xfrd_tcp_set_create(struct region* region) |