diff options
author | Simon Brandner <simon.brandner@partner.bmw.de> | 2013-04-29 12:32:57 +0200 |
---|---|---|
committer | Alexander Wenzel <Alexander.AW.Wenzel@bmw.de> | 2013-07-19 16:54:34 +0200 |
commit | 6cfd7ef76be381315feebdb7ab57c7aa818e4fbe (patch) | |
tree | fb6a0870d43430e55619254550c4371c19b9b6e2 /src/system | |
parent | f06df4fd0887c5adb162ce8e35fa7582491e6d16 (diff) | |
download | DLT-daemon-6cfd7ef76be381315feebdb7ab57c7aa818e4fbe.tar.gz |
fixed filetransfer stopping because of invalid dirnames.
Signed-off-by: Alexander Wenzel <Alexander.AW.Wenzel@bmw.de>
Diffstat (limited to 'src/system')
-rw-r--r-- | src/system/dlt-system-filetransfer.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/system/dlt-system-filetransfer.c b/src/system/dlt-system-filetransfer.c index 504468b..786c13e 100644 --- a/src/system/dlt-system-filetransfer.c +++ b/src/system/dlt-system-filetransfer.c @@ -235,16 +235,14 @@ int send_one(char *src, FiletransferOptions const *opts, int which) // Prepare all needed file names char *fn = basename(src); - char *fdir = malloc(strlen(src)+1); + + char *fdir = strndup(src,PATH_MAX); MALLOC_ASSERT(fdir); - strncpy(fdir,src,strlen(src)); - *(fdir+strlen(fdir))='\0'; fdir = dirname(fdir);//dirname overwrites its argument anyway char *dst_tosend;//file which is going to be sent char *rn = unique_name(src);//new unique filename based on inode - MALLOC_ASSERT(fn); MALLOC_ASSERT(rn); @@ -263,9 +261,6 @@ int send_one(char *src, FiletransferOptions const *opts, int which) snprintf(dst_tocompress,len,"%s/%s/%s",fdir,SUBDIR_COMPRESS,rn); - - - //moving in subdir, from where it can be compressed if(rename(src, dst_tocompress) < 0) { |