Hi
I posted this one on 2002-09-11 on the debian bts but got no reaction
from anyone.
qpopper generates log messages like this one:
Sep 11 12:16:47 mail2 popper[7396]: I/O error flushing output to client joe at
somehost.sld.tld [1.2.3.4]: Operation not permitted (1)
the error message (Operation not permitted) is wrong afaics:
the relevant code from qpopper, pop_send.c is:
void
pop_write_flush ( POP *p )
{
int rslt = 0;
[...]
rslt = fflush ( p->output );
[...]
if ( rslt == EOF ) {
[...]
int e = ferror ( p->output );
pop_log ( p, POP_NOTICE, HERE,
"I/O error flushing output to client %s at %s [%s]: "
"%s (%d)",
p->user, p->client, p->ipaddr, STRERROR(e), e );
[...]
}
[...]
}
from fflush(3):
Upon successful completion 0 is returned. Otherwise, EOF is returned
and the global variable errno is set to indicate the error.
from ferror(3):
The function ferror tests the error indicator for the stream pointed to
by stream, returning non-zero if it is set.
ok, this is what happens:
1. fflush fails for some reason, sets errno to the error number and
returns EOF.
2. qpopper checks the error state of p->output, ferror returns 1
(non-zero!) since there's some error.
3. qpopper uses e (1) instead of errno -> a wrong error message is
generated.
I suggest this patch:
--- pop_send.c.orig 2002-09-11 12:48:38.000000000 +0200
+++ pop_send.c 2002-09-11 12:51:32.000000000 +0200
@@ -685,11 +685,12 @@
if ( p->tls_started )
pop_log ( p, POP_NOTICE, HERE, "Error flushing data to client" );
else {
- int e = ferror ( p->output );
- pop_log ( p, POP_NOTICE, HERE,
- "I/O error flushing output to client %s at %s [%s]: "
- "%s (%d)",
- p->user, p->client, p->ipaddr, STRERROR(e), e );
+ if ( ferror ( p->output ) != 0) {
+ pop_log ( p, POP_NOTICE, HERE,
+ "I/O error flushing output to client %s at %s [%s]: "
+ "%s (%d)",
+ p->user, p->client, p->ipaddr, STRERROR(errno), errno );
+ }
}
hangup = TRUE;
} /* flush failed */
--
Joern "Wulf" Heissler