diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-04-16 03:56:53 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-04-16 03:56:53 +0800 |
commit | 92d9627bb03259894236d22f3eaebd3a487a536a (patch) | |
tree | c7eec919d6e714a465527e73344c26c7279eb269 | |
parent | 9018fbf2607c286a7c390f71b2805c31b3b54827 (diff) | |
download | pttbbs-92d9627bb03259894236d22f3eaebd3a487a536a.tar pttbbs-92d9627bb03259894236d22f3eaebd3a487a536a.tar.gz pttbbs-92d9627bb03259894236d22f3eaebd3a487a536a.tar.bz2 pttbbs-92d9627bb03259894236d22f3eaebd3a487a536a.tar.lz pttbbs-92d9627bb03259894236d22f3eaebd3a487a536a.tar.xz pttbbs-92d9627bb03259894236d22f3eaebd3a487a536a.tar.zst pttbbs-92d9627bb03259894236d22f3eaebd3a487a536a.zip |
fix bug
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@111 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | mbbsd/cache.c | 13 | ||||
-rw-r--r-- | mbbsd/more.c | 7 |
2 files changed, 9 insertions, 11 deletions
diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 4829c929..7f8845c9 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.12 2002/04/15 19:06:21 ptt Exp $ */ +/* $Id: cache.c,v 1.13 2002/04/15 19:56:53 in2 Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -1029,7 +1029,7 @@ int hbflcheck(int bid, int uid) void cachepath(char *cpath, const char *fpath) { char *ptr; - snprintf(cpath, sizeof(cpath), "cache/%s", fpath); + sprintf(cpath, "cache/%s", fpath); for( ptr = &cpath[6] ; *ptr != 0 ; ++ptr ) if( *ptr == '/' ) *ptr = '.'; @@ -1043,13 +1043,10 @@ int updatemdcache(const char *CPATH, const char *fpath) */ int len, sourcefd, targetfd; char buf[1024], *cpath; - if(CPATH==NULL) - { - cpath=buf; - cachepath(buf, fpath); - } + if( CPATH == NULL ) + cachepath(cpath = buf, fpath); else - cpath = CPATH; + cpath = CPATH; if( (sourcefd = open(fpath, O_RDONLY)) < 0 ) return -1; if( (targetfd = open(cpath, O_RDWR | O_CREAT, 0600)) < 0 ) diff --git a/mbbsd/more.c b/mbbsd/more.c index aa706617..0a6cbb59 100644 --- a/mbbsd/more.c +++ b/mbbsd/more.c @@ -1,4 +1,4 @@ -/* $Id: more.c,v 1.5 2002/04/15 19:17:20 ptt Exp $ */ +/* $Id: more.c,v 1.6 2002/04/15 19:56:53 in2 Exp $ */ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -233,12 +233,13 @@ int more(char *fpath, int promptend) { *search_str = 0; #ifdef MDCACHE - if(!promptend && strncmp(fpath,"home",4)){ + //if(!promptend && strncmp(fpath,"home",4)){ + if( strncmp(fpath, "boards/", 7) == 0 || strncmp(fpath, "etc/", 4) == 0 ){ /* we only cache boards/ and etc/ */ char cpath[256]; cachepath(cpath,fpath); ++GLOBE[0]; - if( (fd = open(cpath, O_RDONLY)) < 0 || + if( (fd = open(cpath, O_RDONLY)) < 0 && (fd = updatemdcache(cpath, fpath)) < 0 ) return -1; ++GLOBE[1]; |