diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-28 01:49:32 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-28 01:49:32 +0000 |
commit | 9215b59402084280a5ba360c255d9b1c963e44e5 (patch) | |
tree | 9f934b3c7aa4daee9dc4292344674ca90436e0db | |
parent | 2c7ddf93107d17353e993d8fcc0225e3aee3c7d9 (diff) |
tree(3) wants an int return value for its compare functions and
the difference between two pointers is not an int. Just do the
safest thing and store the result in a long and then return 0,
-1, or 1 based on that result.
-rw-r--r-- | usr.bin/ssh/monitor_mm.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.bin/ssh/monitor_mm.c b/usr.bin/ssh/monitor_mm.c index c6ea2085011..acd90ff1309 100644 --- a/usr.bin/ssh/monitor_mm.c +++ b/usr.bin/ssh/monitor_mm.c @@ -24,7 +24,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: monitor_mm.c,v 1.6 2002/06/04 23:05:49 markus Exp $"); +RCSID("$OpenBSD: monitor_mm.c,v 1.7 2002/06/28 01:49:31 millert Exp $"); #include <sys/mman.h> @@ -36,7 +36,14 @@ RCSID("$OpenBSD: monitor_mm.c,v 1.6 2002/06/04 23:05:49 markus Exp $"); static int mm_compare(struct mm_share *a, struct mm_share *b) { - return ((char *)a->address - (char *)b->address); + long diff = (char *)a->address - (char *)b->address; + + if (diff == 0) + return (0); + else if (diff < 0) + return (-1); + else + return (1); } RB_GENERATE(mmtree, mm_share, next, mm_compare) |