From: Jihun Ha Date: Sat, 6 Aug 2016 01:32:46 +0000 (+0900) Subject: Fix a logic in linking child representation payload in batch interface X-Git-Tag: 1.2.0+RC1~136^2^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d2f91e300c3417e409a1bcdf8fd8c5ff347b1f09;p=platform%2Fupstream%2Fiotivity.git Fix a logic in linking child representation payload in batch interface If provisioning resource receives a GET request with BATCH interface and cloud resource is not created by user's decision, device configuration resource's representation will not delivered even if device configuration resource exists. This patch fixes this issue. Change-Id: I90a43e58cf12dab0732857418fae7f4a7ef9dc1a Signed-off-by: Jihun Ha Reviewed-on: https://gerrit.iotivity.org/gerrit/10091 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- diff --git a/service/easy-setup/enrollee/src/resourcehandler.c b/service/easy-setup/enrollee/src/resourcehandler.c index ed90ddf..b655e27 100755 --- a/service/easy-setup/enrollee/src/resourcehandler.c +++ b/service/easy-setup/enrollee/src/resourcehandler.c @@ -552,25 +552,31 @@ OCRepPayload* constructResponseOfProv(OCEntityHandlerRequest *ehRequest) { if(strstr(ehRequest->query, OC_RSRVD_INTERFACE_BATCH)) {// When Provisioning resource has a GET with BatchInterface - payload->next = constructResponseOfWiFi(); + OCRepPayload* head = payload; + OCRepPayload* nextPayload = NULL; - if(payload->next) + nextPayload = constructResponseOfWiFi(); + if(nextPayload != NULL) { - payload->next->next = constructResponseOfCloud(); - } - else - { - return payload; + payload->next = nextPayload; + payload = payload->next; } - if(payload->next->next) + nextPayload = constructResponseOfCloud(); + if(nextPayload != NULL) { - payload->next->next->next = constructResponseOfDevConf(); + payload->next = nextPayload; + payload = payload->next; } - else + + nextPayload = constructResponseOfDevConf(); + if(nextPayload != NULL) { - return payload; + payload->next = nextPayload; + payload = payload->next; } + + payload = head; } } @@ -978,4 +984,4 @@ const char *getResult(OCStackResult result) default: return "UNKNOWN"; } -} \ No newline at end of file +}