From c47e99d09792772bb6d14e6ed812c735b485b4d9 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Mon, 8 Oct 2012 14:59:25 +1030 Subject: [PATCH] Fix issue #23, regression in 'id' command --- commandline.c | 5 +++-- overlay_mdp.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/commandline.c b/commandline.c index c46bc0ce..34fdbe2c 100644 --- a/commandline.c +++ b/commandline.c @@ -1344,7 +1344,7 @@ int app_id_self(int argc, const char *const *argv, struct command_line_option *o return WHYF("unsupported arg '%s'", argv[1]); a.addrlist.first_sid=0; - while(a.addrlist.frame_sid_count==MDP_MAX_SID_REQUEST) { + do{ result=overlay_mdp_send(&a,MDP_AWAITREPLY,5000); if (result) { if (a.packetTypeAndFlags==MDP_ERROR) @@ -1366,7 +1366,8 @@ int app_id_self(int argc, const char *const *argv, struct command_line_option *o /* get ready to ask for next block of SIDs */ a.packetTypeAndFlags=MDP_GETADDRS; a.addrlist.first_sid=a.addrlist.last_sid+1; - } + }while(a.addrlist.frame_sid_count==MDP_MAX_SID_REQUEST); + return 0; } diff --git a/overlay_mdp.c b/overlay_mdp.c index 6d9b002f..3bffc44e 100644 --- a/overlay_mdp.c +++ b/overlay_mdp.c @@ -951,7 +951,7 @@ static int search_subscribers(struct subscriber *subscriber, void *context){ } if (response->server_sid_count++ >= response->first_sid && - response->first_sid + response->frame_sid_count < response->last_sid) { + response->frame_sid_count < MDP_MAX_SID_REQUEST) { memcpy(response->sids[response->frame_sid_count++], subscriber->sid, SID_SIZE); } @@ -1026,6 +1026,7 @@ void overlay_mdp_poll(struct sched_ent *alarm) case MDP_GETADDRS: { overlay_mdp_frame mdpreply; + bzero(&mdpreply, sizeof(overlay_mdp_frame)); mdpreply.packetTypeAndFlags = MDP_ADDRLIST; if (!overlay_mdp_address_list(&mdp->addrlist, &mdpreply.addrlist)) /* Send back to caller */