From 213e4bc6a87d29e847ca8cdf18b5ddf0fa5b299b Mon Sep 17 00:00:00 2001 From: pzread Date: Sun, 19 May 2013 23:50:05 +0800 Subject: Fix copy permission bug --- toj/center/src/tool.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/toj/center/src/tool.cpp b/toj/center/src/tool.cpp index b4a302d..1502007 100644 --- a/toj/center/src/tool.cpp +++ b/toj/center/src/tool.cpp @@ -84,7 +84,7 @@ static int pack_xopenfn(const char *pathname,int flags,...){ pack_bzinfo *bzinfo; if((fd = open(pathname,flags)) == -1){ - return -1; + return -1; } bzinfo = new pack_bzinfo; @@ -96,6 +96,7 @@ static int pack_xopenfn(const char *pathname,int flags,...){ bzinfo->bzs.opaque = NULL; BZ2_bzDecompressInit(&bzinfo->bzs,0,0); + printf(" %d\n",fd); pack_fdmap.insert(std::pair(fd,bzinfo)); return fd; @@ -115,6 +116,7 @@ static ssize_t pack_xreadfn(long fd,void *buf,size_t count){ int ret; pack_bzinfo *bzinfo; + printf(" %d\n",fd); bzinfo = pack_fdmap.find(fd)->second; bzinfo->bzs.next_out = (char*)buf; @@ -240,7 +242,7 @@ static int copydir_travel(char *old_path,int old_len,char *new_path,int new_len) } infd = open(old_path,O_RDONLY); - outfd = open(new_path,O_WRONLY | O_CREAT); + outfd = open(new_path,O_WRONLY | O_CREAT,0644); fstat(infd,&st); sendfile(outfd,infd,NULL,st.st_size); close(infd); -- cgit v1.2.3