Add Error Handling in Initialization Function
authorManeesh Jain <maneesh.jain@samsung.com>
Fri, 12 Jan 2018 03:38:17 +0000 (09:08 +0530)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:40 +0000 (19:38 +0900)
Signed-off-by: Maneesh Jain <maneesh.jain@samsung.com>
src/fn-manager/src/fn_iot.c

index 9526118ed926b634645e364be4128f4b41ca6454..ccafe4b1ac53f045a5464c9f47df82000f22d878 100755 (executable)
@@ -35,11 +35,20 @@ static bool _request_device_info(iotcon_device_info_h info, iotcon_error_e resul
 int fn_iot_initialize()
 {
        int ret = iotcon_initialize(SVR_PATH);
-       LOG_DEBUG("iotcon_initialize : %s", get_error_message(ret));
+       if (IOTCON_ERROR_NONE != ret) {
+               LOG_ERR("iotcon_initialize: Failed %s", get_error_message(ret));
+               return false;
+       }
 
+       LOG_DEBUG("iotcon_initialize : %s", get_error_message(ret));
        ret = iotcon_find_device_info(IOTCON_MULTICAST_ADDRESS, IOTCON_CONNECTIVITY_ALL,
                                                 NULL, _request_device_info, NULL);
 
+       if (IOTCON_ERROR_NONE != ret) {
+               LOG_ERR("iotcon_find_device_info: Failed %s", get_error_message(ret));
+               return false;
+       }
+
        /*
                "operation" resource
                The operation resource is a control command channel between daemon and daemon.