added fail case for coap_add_option2
added fail case for coap_add_option2

If coap_add_option2 fails, it has to return fail while sending data.
Otherwise, it causes a crash error when it tries to use a pdu wrong.

The below is the comment for coap_add_option2 on libcoap-4.1.1
/**
 * Adds option of given type to pdu that is passed as first
 * parameter. coap_add_option2() destroys the PDU's data, so
 * coap_add_data() must be called after all options have been added.
 * As coap_add_token2() destroys the options following the token,
 * the token must be added before coap_add_option2() is called.
 * This function returns the number of bytes written or @c 0 on error.
 */
size_t coap_add_option2(coap_pdu_t *pdu, unsigned short type, unsigned int len,
                        const unsigned char *data, coap_transport_t transport);

Change-Id: I405c77a63902d9c48b50cb9b94448a9f0e1990f0
Signed-off-by: Jaewook Jung <e30c770b7f9b30402e4d6c2240cd5b03cb3bf7f9@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/15053
Tested-by: jenkins-iotivity <09cb29e8a2b473a2c978382eec13ee06fa017bda@opendaylight.org>
Reviewed-by: Dan Mihai <ba8e1833495515b49ded9e20cae80a8129155aa9@microsoft.com>
Reviewed-by: Phil Coval <ff46fec9739d31cce915aabcc3a7a2c00eee4d6c@osg.samsung.com>
Reviewed-by: Hyuna Jo <a3aecee2eabd6f87461b5d05d6fd0eaf35e269ed@samsung.com>
Reviewed-by: Ashok Babu Channa <72ac47ef856ca3d131a57cba474ebed48591eeff@samsung.com>

iotivity/iotivity,iotivity/iotivity,rzr/iotivity,iotivity/iotivity,iotivity/iotivity,iotivity/iotivity,rzr/iotivity,rzr/iotivity,iotivity/iotivity,rzr/iotivity,iotivity/iotivity,iotivity/iotivity,rzr/iotivity,rzr/iotivity,rzr/iotivity