summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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