From: Simon Brandner Date: Mon, 29 Apr 2013 10:32:57 +0000 (+0200) Subject: fixed filetransfer stopping because of invalid dirnames. X-Git-Tag: v2.9.1~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6cfd7ef76be381315feebdb7ab57c7aa818e4fbe;p=profile%2Fivi%2Fdlt-daemon.git fixed filetransfer stopping because of invalid dirnames. Signed-off-by: Alexander Wenzel --- 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) {