Bug 1366

Summary: atomicio doesn't poll()
Product: Portable OpenSSH Reporter: Benjamin Bennett <ben>
Component: MiscellaneousAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED FIXED    
Severity: normal CC: djm
Priority: P2    
Version: 4.7p1   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1353    
Attachments:
Description Flags
Patch to fix atomicio and atomiciov non-polling spin none

Description Benjamin Bennett 2007-09-21 04:04:32 AEST
Created attachment 1355 [details]
Patch to fix atomicio and atomiciov non-polling spin

atomicio contains the following in the read/write loop:

-----
                case -1:
#ifdef EWOULDBLOCK
                        if (errno == EINTR || errno == EWOULDBLOCK)
#else
                        if (errno == EINTR)
#endif
                                continue;
                        if (errno == EAGAIN) {
                                (void)poll(&pfd, 1, -1);
                                continue;
                        }
                        return 0;
-----

On systems where errno is set to EWOULDBLOCK we spin on the read or write without polling.  On many other systems (Linux, Solaris, IRIX, ...) EWOULDBLOCK is defined as EAGAIN, and when errno is set to EAGAIN we spin on the read or write without polling.

Please see patch.

thanks,

--ben
Comment 1 Damien Miller 2007-09-21 13:14:59 AEST
Patch applied - thanks.
Comment 2 Damien Miller 2008-03-31 15:21:28 AEDT
Fix shipped in 4.9/4.9p1 release.