summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-08-06 08:11:23 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-08-06 08:18:53 (GMT)
commit84dbb8c1cd134f281ffd007dabeec16530fb1a2d (patch)
tree85943fd4b00858e263a19e1dd548d7d41f523319
parent6aba37b1a1674a78e2215c6ab399d1a0bfea846f (diff)
downloaddata-provider-master-84dbb8c1cd134f281ffd007dabeec16530fb1a2d.zip
data-provider-master-84dbb8c1cd134f281ffd007dabeec16530fb1a2d.tar.gz
data-provider-master-84dbb8c1cd134f281ffd007dabeec16530fb1a2d.tar.bz2
Change-Id: I34b194ff1b551dfcc13f588253198e885f3e258d
-rw-r--r--packaging/data-provider-master.spec2
-rw-r--r--src/buffer_handler.c4
-rw-r--r--src/file_service.c10
3 files changed, 10 insertions, 6 deletions
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index e74fad7..3f989e5 100644
--- a/packaging/data-provider-master.spec
+++ b/packaging/data-provider-master.spec
@@ -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
diff --git a/src/buffer_handler.c b/src/buffer_handler.c
index ea35e84..2c5493c 100644
--- a/src/buffer_handler.c
+++ b/src/buffer_handler.c
@@ -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);
diff --git a/src/file_service.c b/src/file_service.c
index 15c2304..eabf755 100644
--- a/src/file_service.c
+++ b/src/file_service.c
@@ -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) {