summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManikandan C <Manikandan.Chockalingam@in.bosch.com>2016-07-04 17:09:27 +0530
committerChristoph Lipka <clipka@jp.adit-jv.com>2016-10-24 13:39:56 +0900
commit206397282c3adbdcbc6a163d6692588d214e62ed (patch)
tree186d60834b53b1b5e0675f84f11e2eec50c0df6e
parentdf990beaf93963fbe0f9c040959b0dfa7c08e472 (diff)
downloadDLT-daemon-206397282c3adbdcbc6a163d6692588d214e62ed.tar.gz
dlt-system-filetransfer: fix bug caused by malloc assert
Remove malloc assert in inappropriate location and add error logs in case of failures. Signed-off-by: Manikandan C <Manikandan.Chockalingam@in.bosch.com>
-rw-r--r--src/system/dlt-system-filetransfer.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index 7bc1671..819b6de 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -257,6 +257,13 @@ int send_one(char *src, FiletransferOptions const *opts, int which)
// Prepare all needed file names
char *fn = basename(src);
+ if (fn == NULL)
+ {
+ DLT_LOG(dltsystem,
+ DLT_LOG_ERROR,
+ DLT_STRING("basename not valid"));
+ return -1;
+ }
char *fdir = strndup(src,PATH_MAX);
MALLOC_ASSERT(fdir);
@@ -265,16 +272,14 @@ int send_one(char *src, FiletransferOptions const *opts, int which)
char *rn = unique_name(src);//new unique filename based on inode
- if(rn == NULL)
+ if (rn == NULL)
{
- // unique name couldn't be generated
- // (usually because the file could not be found because it has
- // already been sent by a previous change/move of the same file)
+ DLT_LOG(dltsystem,
+ DLT_LOG_ERROR,
+ DLT_STRING("file information not available, may be file got overwritten"));
return -1;
}
- MALLOC_ASSERT(fn);
-
// Compress if needed
if(opts->Compression[which] > 0)
{