summaryrefslogtreecommitdiff
path: root/src/system
diff options
context:
space:
mode:
authorSven Hassler <sven_hassler@mentor.com>2016-02-11 09:03:13 +0100
committerLutz Helwing <lutz_helwing@mentor.com>2016-02-19 10:04:46 +0100
commit858e87c83bc527a546ee7ec3617f2a306a5e45fc (patch)
tree364fcb4a12a8a8c267ea6b4c10c0c9e4016bace4 /src/system
parentef2e05cad3790dab8c5940d24d17b24949ea21af (diff)
downloadDLT-daemon-858e87c83bc527a546ee7ec3617f2a306a5e45fc.tar.gz
Bugfix: dlt-system filetransfer crash
If a file get written to after it appeared in a folder that is watched by the dlt-system filetransfer thread, the application tries to send this file multiple times, causing it to crash. This patch fixes this by canceling the sending process more gracefully if the file cannot be found. Change-Id: Id19b72061bed41642d12cd33afeaa41fb444b2c8 Signed-off-by: Lutz Helwing <lutz_helwing@mentor.com>
Diffstat (limited to 'src/system')
-rw-r--r--src/system/dlt-system-filetransfer.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c
index 6d519ac..7e141f5 100644
--- a/src/system/dlt-system-filetransfer.c
+++ b/src/system/dlt-system-filetransfer.c
@@ -263,8 +263,15 @@ int send_one(char *src, FiletransferOptions const *opts, int which)
char *rn = unique_name(src);//new unique filename based on inode
+ 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)
+ return -1;
+ }
+
MALLOC_ASSERT(fn);
- MALLOC_ASSERT(rn);
// Compress if needed
if(opts->Compression[which] > 0)