line too long?
Alex Kiernan
alexk at demon.net
Tue Apr 3 10:43:42 UTC 2001
Alex Kiernan <alexk at demon.net> writes:
> Katsuhiro Kondou <kondou at nec.co.jp> writes:
>
> > In article <Pine.BSF.4.33.0104030004120.91376-100000 at mobile.hub.org>,
> > The Hermit Hacker <scrappy at hub.org> wrote;
> >
> > } few sm samples:
> > }
> > } =============
> > } news.hub.org> sm @03046374726C31000000000310260000003D@
> > } CBuf3ctrl1/news/spool/articles/control00000000064a000000000000017e9400000000003ac6f647000000000000003e
> >
> > Hm, the problem you're seeing is just same as what Joe saw.
> > Flushed cycbuff header is incorrectly written to where article
> > should start. cnfs.c was modified to be more smart by Alex on
> > Feb 12, and the patch looks ok to me. You can revert to 1.82
> > which should work, but corrupted articles cannot help. If it
> > really works, I tend to revert or investigate.
>
> Think I've spotted it (and my fault :-( Looks like I missed a couple
> of of the reads when changing read -> pread and you're not running
> with articlemmap.
>
> Here's the patch I'm about to test:
>
Ahem... and with pread where it should be :-( Should work with
OLD_CNFS defined too. It seems to have fixed the problem though:
Index: cnfs.c
===================================================================
RCS file: /upstream-repositories/inn-cvs.isc.org/inn/storage/cnfs/cnfs.c,v
retrieving revision 1.84
diff -c -r1.84 cnfs.c
*** cnfs.c 2001/03/29 01:04:10 1.84
--- cnfs.c 2001/04/03 10:38:24
***************
*** 1272,1279 ****
private = NEW(PRIV_CNFS, 1);
art->private = (void *)private;
art->arrived = ntohl(cah.arrived);
if (innconf->articlemmap) {
- offset += sizeof(cah) + plusoffset;
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
private->len = pagefudge + ntohl(cah.size);
--- 1272,1279 ----
private = NEW(PRIV_CNFS, 1);
art->private = (void *)private;
art->arrived = ntohl(cah.arrived);
+ offset += sizeof(cah) + plusoffset;
if (innconf->articlemmap) {
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
private->len = pagefudge + ntohl(cah.size);
***************
*** 1300,1306 ****
} else {
private->base = NEW(char, ntohl(cah.size));
pagefudge = 0;
! if (read(cycbuff->fd, private->base, ntohl(cah.size)) < 0) {
SMseterror(SMERR_UNDEFINED, "read failed");
syslog(L_ERROR, "%s: could not read token %s %s:0x%s:%ld: %m",
LocalLogName, TokenToText(token), cycbuffname, CNFSofft2hex(offset, FALSE), cycnum);
--- 1300,1306 ----
} else {
private->base = NEW(char, ntohl(cah.size));
pagefudge = 0;
! if (pread(cycbuff->fd, private->base, ntohl(cah.size), offset) < 0) {
SMseterror(SMERR_UNDEFINED, "read failed");
syslog(L_ERROR, "%s: could not read token %s %s:0x%s:%ld: %m",
LocalLogName, TokenToText(token), cycbuffname, CNFSofft2hex(offset, FALSE), cycnum);
***************
*** 1602,1609 ****
art->arrived = ntohl(cah.arrived);
token = CNFSMakeToken(cycbuff->name, offset, (offset > cycbuff->free) ? cycbuff->cyclenum - 1 : cycbuff->cyclenum, cah.class);
art->token = &token;
if (innconf->articlemmap) {
- offset += sizeof(cah) + plusoffset;
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
private->len = pagefudge + ntohl(cah.size);
--- 1602,1609 ----
art->arrived = ntohl(cah.arrived);
token = CNFSMakeToken(cycbuff->name, offset, (offset > cycbuff->free) ? cycbuff->cyclenum - 1 : cycbuff->cyclenum, cah.class);
art->token = &token;
+ offset += sizeof(cah) + plusoffset;
if (innconf->articlemmap) {
pagefudge = offset % pagesize;
mmapoffset = offset - pagefudge;
private->len = pagefudge + ntohl(cah.size);
***************
*** 1628,1634 ****
} else {
private->base = NEW(char, ntohl(cah.size));
pagefudge = 0;
! if (read(cycbuff->fd, private->base, ntohl(cah.size)) < 0) {
art->data = NULL;
art->len = 0;
art->token = NULL;
--- 1628,1634 ----
} else {
private->base = NEW(char, ntohl(cah.size));
pagefudge = 0;
! if (pread(cycbuff->fd, private->base, ntohl(cah.size), offset) < 0) {
art->data = NULL;
art->len = 0;
art->token = NULL;
--
Alex Kiernan, Principal Engineer, Development, Thus PLC
More information about the inn-workers
mailing list