From 858e87c83bc527a546ee7ec3617f2a306a5e45fc Mon Sep 17 00:00:00 2001 From: Sven Hassler Date: Thu, 11 Feb 2016 09:03:13 +0100 Subject: 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 --- src/system/dlt-system-filetransfer.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) -- cgit v1.2.1