From e449477e01540e4eae2ad9099ad2f3c35ddfe2f9 Mon Sep 17 00:00:00 2001 From: ptt Date: Mon, 15 Apr 2002 19:06:22 +0000 Subject: *** empty log message *** git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@109 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/cache.c | 12 +++++------- mbbsd/more.c | 10 ++++------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/mbbsd/cache.c b/mbbsd/cache.c index 2182423f..4829c929 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.11 2002/04/15 17:11:37 ptt Exp $ */ +/* $Id: cache.c,v 1.12 2002/04/15 19:06:21 ptt Exp $ */ #include #include #include @@ -1058,12 +1058,10 @@ int updatemdcache(const char *CPATH, const char *fpath) while( (len = read(sourcefd, buf, sizeof(buf))) > 0 ) if( write(targetfd, buf, len) < len ){ /* md is full? */ - close(targetfd); - unlink(cpath); - return sourcefd; } - close(sourcefd); - lseek(targetfd, 0, SEEK_SET); - return targetfd; + close(targetfd); + lseek(sourcefd, 0, SEEK_SET); + + return sourcefd; } #endif diff --git a/mbbsd/more.c b/mbbsd/more.c index 4265d75f..c8abd17e 100644 --- a/mbbsd/more.c +++ b/mbbsd/more.c @@ -1,4 +1,4 @@ -/* $Id: more.c,v 1.3 2002/04/15 17:07:11 ptt Exp $ */ +/* $Id: more.c,v 1.4 2002/04/15 19:06:22 ptt Exp $ */ #include #include #include @@ -238,12 +238,10 @@ int more(char *fpath, int promptend) { char cpath[256]; cachepath(cpath,fpath); ++GLOBE[0]; - if( (fd = open(cpath, O_RDONLY)) < 0 ){ - if( (fd = updatemdcache(cpath, fpath)) < 0 ) + if( (fd = open(cpath, O_RDONLY)) < 0 || + (fd = updatemdcache(cpath, fpath)) < 0 ) return -1; - } - else - ++GLOBE[1]; + ++GLOBE[1]; } else fd = open (fpath, O_RDONLY, 0600); -- cgit v1.2.3