summaryrefslogtreecommitdiffstats
path: root/mbbsd/read.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-18 12:36:22 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-09-18 12:36:22 +0800
commit50584f9c86536defe77b96f31479619f29fe9eff (patch)
tree9023806c700a947163bdf7af59b0a78595bc320d /mbbsd/read.c
parent81ec9caa96cb5d68e6417d168b5eadb17f63a5e4 (diff)
downloadpttbbs-50584f9c86536defe77b96f31479619f29fe9eff.tar
pttbbs-50584f9c86536defe77b96f31479619f29fe9eff.tar.gz
pttbbs-50584f9c86536defe77b96f31479619f29fe9eff.tar.bz2
pttbbs-50584f9c86536defe77b96f31479619f29fe9eff.tar.lz
pttbbs-50584f9c86536defe77b96f31479619f29fe9eff.tar.xz
pttbbs-50584f9c86536defe77b96f31479619f29fe9eff.tar.zst
pttbbs-50584f9c86536defe77b96f31479619f29fe9eff.zip
fix ticket #10
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3188 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/read.c')
-rw-r--r--mbbsd/read.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 70fdbe3e..7e781de5 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -334,7 +334,16 @@ thread(const keeploc_t * locmem, int stypen)
for( new_ln = pos + step ;
new_ln > 0 && new_ln <= last_line && --jump > 0;
new_ln += step ) {
- get_record_keep(currdirect, &fh, sizeof(fileheader_t), new_ln, &fd);
+
+ int rk =
+ get_record_keep(currdirect, &fh, sizeof(fileheader_t), new_ln, &fd);
+
+ if(fd < 0 || rk < 0)
+ {
+ new_ln = pos;
+ break;
+ }
+
if( stypen & RS_TITLE ){
if( stypen & RS_FIRST ){
if( !strncmp(fh.title, key, PROPER_TITLE_LEN) )
@@ -353,14 +362,17 @@ thread(const keeploc_t * locmem, int stypen)
break;
}
else{ // RS_AUTHOR
- if( !strcmp(subject(fh.owner), key) )
+ if( strcmp(subject(fh.owner), key) == EQUSTR )
break;
}
}
+
if( fd != -1 )
close(fd);
+
if( jump <= 0 || new_ln <= 0 || new_ln > last_line )
new_ln = (amatch == -1 ? pos : amatch); //didn't find
+
return new_ln;
}