summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-16 17:35:27 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2003-11-16 17:35:27 +0800
commit4cd1c87a51641132f08523c55d09aa3dcca2528f (patch)
tree1b5c52556da0290f023274bde0c1270f74b96ef8
parent7986c60cafb36fe29f73e9cc9f18cfef610fed84 (diff)
downloadpttbbs-4cd1c87a51641132f08523c55d09aa3dcca2528f.tar
pttbbs-4cd1c87a51641132f08523c55d09aa3dcca2528f.tar.gz
pttbbs-4cd1c87a51641132f08523c55d09aa3dcca2528f.tar.bz2
pttbbs-4cd1c87a51641132f08523c55d09aa3dcca2528f.tar.lz
pttbbs-4cd1c87a51641132f08523c55d09aa3dcca2528f.tar.xz
pttbbs-4cd1c87a51641132f08523c55d09aa3dcca2528f.tar.zst
pttbbs-4cd1c87a51641132f08523c55d09aa3dcca2528f.zip
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1349 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c2
-rw-r--r--mbbsd/kaede.c21
2 files changed, 11 insertions, 12 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 63c44ac6..3f1744f3 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -852,7 +852,7 @@ b_posttype(int ent, fileheader_t * fhdr, char *direct)
int i, aborted;
char filepath[256], genbuf[60], title[5], posttype_f, posttype[33]="";
- if(!currmode & MODE_BOARD) return DONOTHING;
+ if(!(currmode & MODE_BOARD)) return DONOTHING;
bp = getbcache(currbid);
diff --git a/mbbsd/kaede.c b/mbbsd/kaede.c
index e52bb6fc..326bc427 100644
--- a/mbbsd/kaede.c
+++ b/mbbsd/kaede.c
@@ -76,17 +76,16 @@ Rename(char *src, char *dst)
int
Copy(char *src, char *dst)
{
- FILE *fi, *fo;
- char buf[513];
- fi=fopen(src, "r");
- if(!fi) return -1;
- fo=fopen(dst, "w");
- if(!fo) {fclose(fi); return -1;}
- buf[512]=0;
- while(fgets(buf,512,fi))
- fputs(buf,fo);
- fclose(fo);
- fclose(fi);
+ int fi, fo, bytes;
+ char buf[8192];
+ fi=open(src, O_RDONLY);
+ if(fi<0) return -1;
+ fo=open(dst, O_WRONLY);
+ if(fo<0) {close(fi); return -1;}
+ while((bytes=read(fi, buf, 8192))>0)
+ write(fo, buf, bytes);
+ close(fo);
+ close(fi);
return 0;
}
int