diff options
author | pzread <netfirewall@gmail.com> | 2013-05-19 23:50:05 +0800 |
---|---|---|
committer | pzread <netfirewall@gmail.com> | 2013-05-19 23:50:05 +0800 |
commit | 213e4bc6a87d29e847ca8cdf18b5ddf0fa5b299b (patch) | |
tree | 623eaba3427fa2886a89237325d01a8c90068304 | |
parent | 1b1f7448502c4868353e54326e1b8490a3337d57 (diff) | |
download | taiwan-online-judge-1.0.tar.gz taiwan-online-judge-1.0.tar.zst taiwan-online-judge-1.0.zip |
Fix copy permission bug1.0
-rw-r--r-- | toj/center/src/tool.cpp | 6 |
1 files 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<int,pack_bzinfo*>(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); |