http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=95669367427640&w=2 (fwd)
Ishikawa
ishikawa at yk.rim.or.jp
Fri Apr 28 05:08:59 EST 2000
John P Speno wrote:
> On Thu, Apr 27, 2000 at 03:50:50AM +0200, Harold Gutch wrote:
> > On Thu, Apr 27, 2000 at 09:55:56AM +1000, Damien Miller wrote:
> > > + if (errno == EGAIN)
> > > + continue;
> >
> > Just wondering, as my only OpenBSD box currently is down -
> > shouldn't that be EAGAIN instead of EGAIN?
>
> Yes, it should, and that still doesn't fix the problem I'm seeing with scp.
> My system trace seems to indicate that the problem occurs when a read() is
> interrupted.
I am curious about this thread:
Why don't relevant references to read/write use atomicio() in atomicio.c?
The usage should be clear.
result = read(fd, buf, num)
becomes
result = atomicio(read, fd, buf, num)
I have been bitten with similar interrupted system calls before.
To avoid these problems, read/write ought to be wrapped in something like
atomicio().
Most network read/write fall under this category.
One more tip I can think of.
Although openssh/scp doesn't use ferror() at all,
if we ever use ferror() [if we use (FILE *), that is by assigning buffered
I/O data
structure to the file descriptor],
clearerr() needs to be called in order to clear incorrectly raised
error status due to the interrupted system call (!)
This is true for at least Solaris 2.5.1, and Solaris 7, etc..
This is so counter-intuitive and some well known code failed to
operate as the original authors intended for a long time due to this
`feature',
but people assumed the broken behavior for granted!
Happy Hacking,
Ishikawa
More information about the openssh-unix-dev
mailing list