diff options
author | mouring <mouring> | 2002-07-04 00:08:23 +0000 |
---|---|---|
committer | mouring <mouring> | 2002-07-04 00:08:23 +0000 |
commit | 722cc070f95a08a5b7934a9c3a4e38834b9ae06e (patch) | |
tree | acda947324acebd3b3c30b95d2bf9dab81d9c200 /monitor_mm.c | |
parent | 8dbe8c32e165863ac2dd75cb29f9aa14f9bb03d4 (diff) | |
download | openssh-722cc070f95a08a5b7934a9c3a4e38834b9ae06e.tar.gz |
- millert@cvs.openbsd.org 2002/06/28 01:49:31
[monitor_mm.c]
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.
Diffstat (limited to 'monitor_mm.c')
-rw-r--r-- | monitor_mm.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/monitor_mm.c b/monitor_mm.c index c363036e..f72a180e 100644 --- a/monitor_mm.c +++ b/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 $"); #ifdef HAVE_SYS_MMAN_H #include <sys/mman.h> @@ -38,7 +38,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) |