Fix the prevent issues. 2.2_release submit/tizen_2.2/20130814.085257 submit/tizen_2.2/20130814.101311
authorSung-jae Park <nicesj.park@samsung.com>
Tue, 6 Aug 2013 08:11:23 +0000 (17:11 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Tue, 6 Aug 2013 08:18:53 +0000 (17:18 +0900)
Change-Id: I34b194ff1b551dfcc13f588253198e885f3e258d

packaging/data-provider-master.spec
src/buffer_handler.c
src/file_service.c

index e74fad7..3f989e5 100644 (file)
@@ -1,6 +1,6 @@
 Name: data-provider-master
 Summary: Master service provider for liveboxes.
-Version: 0.25.2
+Version: 0.25.3
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index ea35e84..2c5493c 100644 (file)
@@ -1332,6 +1332,7 @@ static inline struct buffer *raw_open_file(const char *filename)
        struct buffer *buffer;
        int fd;
        off_t off;
+       int ret;
 
        fd = open(filename, O_RDONLY);
        if (fd < 0) {
@@ -1373,7 +1374,8 @@ static inline struct buffer *raw_open_file(const char *filename)
        buffer->refcnt = 0;
        buffer->info = (void *)off;
 
-       if (read(fd, buffer->data, off) < 0) {
+       ret = read(fd, buffer->data, off);
+       if (ret < 0) {
                ErrPrint("read: %s\n", strerror(errno));
                free(buffer);
 
index 15c2304..eabf755 100644 (file)
@@ -120,6 +120,8 @@ static inline struct request_item *create_request_item(struct tcb *tcb, int type
                item->data.shm = (int)data;
                break;
        default:
+               ErrPrint("Invalid type of request\n");
+               free(item);
                return NULL;
        }
 
@@ -398,14 +400,10 @@ static int send_file(int handle, const struct request_item *item)
        while (fsize > 0) {
                if (fsize > PKT_CHUNKSZ) {
                        body->size = PKT_CHUNKSZ;
-                       fsize -= PKT_CHUNKSZ;
                } else {
                        body->size = fsize;
-                       fsize = 0;
                }
 
-               pktsz = sizeof(*body) + body->size;
-
                ret = read(fd, body->data, body->size); 
                if (ret < 0) {
                        ErrPrint("read: %s\n", strerror(errno));
@@ -413,6 +411,10 @@ static int send_file(int handle, const struct request_item *item)
                        break;
                }
 
+               body->size = ret;
+               fsize -= ret;
+               pktsz = sizeof(*body) + body->size;
+
                /* Send BODY */
                ret = com_core_send(handle, (void *)body, pktsz, 2.0f);
                if (ret != pktsz) {