Fix various bugs.
authorSung-jae Park <nicesj.park@samsung.com>
Thu, 20 Jun 2013 07:51:36 +0000 (16:51 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Thu, 20 Jun 2013 07:51:36 +0000 (16:51 +0900)
If the service_trigger_update fails, return its status.

[issue#] N/A
[problem] User wants to know how many instances are affected by update trigger request.
[cause] Docomo requires this.
[solution] Check the created instances and return NOT_EXISTS if there are no instances.
[team] HomeTF
[request]
[horizontal_expansion]
--------------------------------------------

Remove unnecessary storage space check code

[issue#] P130607-6207
[problem] PD open/close is not related with storage space.
[cause] Even if a user tries to open a PD, master checks disk space for openning it.
[solution] PD open is not necessary to check the free disk space. So remove it.
[team] HomeTF
[request]
[horizontal_expansion]
--------------------------------------------

Apply GCC 4.8 patch

[issue#] N/A
[problem] GCC 4.8 complier complains about unused variables.
[cause] Unused variables are declared.
[solution] Remove it.
[team] HomeTF
[request]
[horizontal_expansion]
--------------------------------------------

Change-Id: Id861b50f65a00c3c9a25b1c01be7068e897f74e2

packaging/data-provider-master.spec
src/server.c
src/service_common.c

index 4c9b77e..17922f9 100644 (file)
@@ -1,6 +1,6 @@
 Name: data-provider-master
 Summary: Master service provider for liveboxes.
-Version: 0.24.8
+Version: 0.24.9
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index e4a2b8e..c916263 100644 (file)
@@ -4711,9 +4711,7 @@ static struct packet *client_create_pd(pid_t pid, int handle, const struct packe
        if (ret != LB_STATUS_SUCCESS)
                goto out;
 
-       if (util_free_space(IMAGE_PATH) < MINIMUM_SPACE) {
-               ret = LB_STATUS_ERROR_NO_SPACE;
-       } else if (instance_pd_owner(inst)) {
+       if (instance_pd_owner(inst)) {
                ret = LB_STATUS_ERROR_ALREADY;
        } else if (package_pd_type(instance_package(inst)) == PD_TYPE_BUFFER) {
                lazy_pd_destroyed_cb(inst);
@@ -5978,13 +5976,6 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
                goto out;
        }
 
-       if (util_free_space(IMAGE_PATH) < MINIMUM_SPACE) {
-               ErrPrint("Not enough space\n");
-               ret = LB_STATUS_ERROR_NO_SPACE;
-               id = "";
-               goto out;
-       }
-
        ret = validate_request(pkgname, id, &inst, &pkg);
        id = "";
 
@@ -6124,13 +6115,6 @@ static struct packet *slave_resize_buffer(pid_t pid, int handle, const struct pa
                goto out;
        }
 
-       if (util_free_space(IMAGE_PATH) < MINIMUM_SPACE) {
-               ErrPrint("Not enough space\n");
-               ret = LB_STATUS_ERROR_NO_SPACE;
-               id = "";
-               goto out;
-       }
-
        ret = validate_request(pkgname, id, &inst, &pkg);
        id = "";
        if (ret != LB_STATUS_SUCCESS)
@@ -6359,6 +6343,7 @@ out:
 
 static struct packet *service_update(pid_t pid, int handle, const struct packet *packet)
 {
+       Eina_List *inst_list;
        struct pkg_info *pkg;
        struct packet *result;
        const char *pkgname;
@@ -6395,6 +6380,31 @@ static struct packet *service_update(pid_t pid, int handle, const struct packet
                goto out;
        }
 
+       inst_list = package_instance_list(pkg);
+       if (!eina_list_count(inst_list)) {
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               DbgFree(lb_pkgname);
+               goto out;
+       }
+
+       if (id && strlen(id)) {
+               Eina_List *l;
+               struct inst_info *inst;
+
+               ret = LB_STATUS_ERROR_NOT_EXIST;
+               EINA_LIST_FOREACH(inst_list, l, inst) {
+                       if (!strcmp(instance_id(inst), id)) {
+                               ret = LB_STATUS_SUCCESS;
+                               break;
+                       }
+               }
+
+               if (ret == LB_STATUS_ERROR_NOT_EXIST) {
+                       DbgFree(lb_pkgname);
+                       goto out;
+               }
+       }
+
        /*!
         * \TODO
         * Validate the update requstor.
index d6d4007..2b57e56 100644 (file)
@@ -813,14 +813,11 @@ HAPI struct service_context *tcb_svc_ctx(struct tcb *tcb)
  */
 HAPI int service_common_unicast_packet(struct tcb *tcb, struct packet *packet)
 {
-       struct service_context *svc_ctx;
        if (!tcb || !packet) {
                DbgPrint("Invalid unicast: tcb[%p], packet[%p]\n", tcb, packet);
                return -EINVAL;
        }
 
-       svc_ctx = tcb->svc_ctx;
-
        DbgPrint("Unicast packet\n");
        return secure_socket_send(tcb->fd, (void *)packet_data(packet), packet_size(packet));
 }