diff options
Diffstat (limited to 'util/shmctl.c')
-rw-r--r-- | util/shmctl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/util/shmctl.c b/util/shmctl.c index 4a1a2a4c..e50fef43 100644 --- a/util/shmctl.c +++ b/util/shmctl.c @@ -280,8 +280,12 @@ cmputmpidle(const void * i, const void * j) static int cmputmpfrom(const void * i, const void * j) { - // desc sorted - return -(SHM->uinfo[*(int*)i].from_ip - SHM->uinfo[*(int*)j].from_ip); + int r = strcmp(SHM->uinfo[*(int*)i].from, SHM->uinfo[*(int*)j].from); + if (r) return r; + + // *** from_ip (in_addr_t) is big endian network number. + return memcmp(&(SHM->uinfo[*(int*)i].from_ip), &(SHM->uinfo[*(int*)j].from_ip), + sizeof(SHM->uinfo[0].from_ip)); } static int |