diff options
author | Simon Brandner <simon.brandner@partner.bmw.de> | 2013-04-29 13:07:34 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2013-07-19 16:54:36 +0200 |
commit | 733a1111254882aec6ebc9c90bb690aaee3f2773 (patch) | |
tree | 64c1bcb5cecbbdc20ec26a2128519f7425e41e6f | |
parent | 6cfd7ef76be381315feebdb7ab57c7aa818e4fbe (diff) | |
download | dlt-daemon-733a1111254882aec6ebc9c90bb690aaee3f2773.tar.gz dlt-daemon-733a1111254882aec6ebc9c90bb690aaee3f2773.tar.bz2 dlt-daemon-733a1111254882aec6ebc9c90bb690aaee3f2773.zip |
Fixed corruption of transferred filenames because of variable ID-length in unique_name creation by prepending zeros
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
-rw-r--r-- | src/system/dlt-system-filetransfer.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c index 786c13e..a4b0aff 100644 --- a/src/system/dlt-system-filetransfer.c +++ b/src/system/dlt-system-filetransfer.c @@ -97,8 +97,6 @@ char *unique_name(char *src) DLT_STRING("dlt-system-filetransfer, creating unique temporary file name.")); time_t t = time(NULL); unsigned long l = getFileSerialNumber(src) ^ t; - // Length of ULONG_MAX + 1 - //char *ret = malloc(11); char *basename_f = basename(src); // Length of ULONG_MAX + 1 @@ -112,7 +110,7 @@ char *unique_name(char *src) char *ret = malloc(len); MALLOC_ASSERT(ret); - snprintf(ret, len, "%lu%s", l,basename_f); + snprintf(ret, len, "%010lu%s", l,basename_f); return ret; } @@ -120,8 +118,8 @@ char *unique_name(char *src) * Function which only calls the relevant part to transfer the payload */ -void send_dumped_file(FiletransferOptions const *opts,char *dst_tosend){ - +void send_dumped_file(FiletransferOptions const *opts,char *dst_tosend) +{ char *fn = origin_name(dst_tosend); DLT_LOG(dltsystem, DLT_LOG_DEBUG, @@ -278,8 +276,6 @@ int send_one(char *src, FiletransferOptions const *opts, int which) MALLOC_ASSERT(dst_tosend); snprintf(dst_tosend,len,"%s/%s/%s%s",fdir,SUBDIR_TOSEND,rn,COMPRESS_EXTENSION); - - if (compress_file_to(dst_tocompress,dst_tosend, opts->CompressionLevel[which]) != 0){ free(rn); free(dst_tosend); |