summaryrefslogtreecommitdiff
path: root/src/system
diff options
context:
space:
mode:
authorSimon Brandner <simon.brandner@partner.bmw.de>2013-01-25 15:52:46 +0100
committerAlexander Wenzel <Alexander.AW.Wenzel@bmw.de>2013-07-19 16:54:25 +0200
commit0c2ac36389567e46804d48f5b3a410016c7fb07e (patch)
tree468d77671579d8edbe861dda7584589e606ab17a /src/system
parent43e6aeecf6b35f95bdfe55c3b4d7ef7fc384db30 (diff)
downloadDLT-daemon-0c2ac36389567e46804d48f5b3a410016c7fb07e.tar.gz
added length check for inotify event
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/system')
-rw-r--r--src/system/dlt-system-filetransfer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index 64ac487..504468b 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -612,7 +612,7 @@ int init_filetransfer_dirs(FiletransferOptions const *opts)
subdirpath= malloc (len);
MALLOC_ASSERT(subdirpath);
snprintf(subdirpath,len,"%s/%s",opts->Directory[i],SUBDIR_TOSEND);
- mkdir(subdirpath,0777);
+ ret = mkdir(subdirpath,0777);
if (0 != ret && EEXIST != errno){
DLT_LOG(dltsystem, DLT_LOG_ERROR,
DLT_STRING("dlt-system-filetransfer, error creating subdirectory: "),DLT_STRING(subdirpath),DLT_STRING(" Errorcode: "),DLT_INT(errno));
@@ -645,7 +645,7 @@ int wait_for_files(FiletransferOptions const *opts)
{
DLT_LOG(dltsystem, DLT_LOG_DEBUG, DLT_STRING("dlt-system-filetransfer, waiting for files."));
static char buf[INOTIFY_LEN];
- int len = read(ino.handle, buf, INOTIFY_LEN);
+ ssize_t len = read(ino.handle, buf, INOTIFY_LEN);
if(len < 0)
{
DLT_LOG(filetransferContext, DLT_LOG_ERROR,
@@ -653,8 +653,8 @@ int wait_for_files(FiletransferOptions const *opts)
return -1;
}
- int i = 0;
- while(i<len)
+ unsigned int i = 0;
+ while(i < (len-INOTIFY_SZ))
{
struct inotify_event *ie = (struct inotify_event *)&buf[i];
if(ie->len > 0)