View Issue Details

IDProjectCategoryView StatusLast Update
00008361003.1(2013)/Issue7+TC1System Interfacespublic2019-06-10 08:54
Reportereblake Assigned To 
PrioritynormalSeverityObjectionTypeEnhancement Request
Status ClosedResolutionAccepted 
NameEric Blake
OrganizationRed Hat
User Referenceeblake.accept
Sectionaccept
Page Number563
Line Number19506
Interp Status---
Final Accepted Text
Summary0000836: accept() should not modify address_len on failure
DescriptionThe standard states that accept() modifies the address_len parameter on output to record the size of the stored address, but does not state whether this modification occurs even on failure. Thus, an implementation could feasibly set this parameter to 0 on failure, and an application that does:
    addrlen = sizeof(addr);
    do {
        ret = accept(sock, (struct sockaddr *)&addr, &addrlen);
    } while (ret == -1 && errno == EINTR);
risks failure, in comparison to:
    do {
        addrlen = sizeof(addr);
        ret = accept(sock, (struct sockaddr *)&addr, &addrlen);
    } while (ret == -1 && errno == EINTR);


But traditionally, implementations only modify the address_len parameter on success. Guaranteeing this fact will make it so that applications do not have to worry whether their EINTR retry loop has a subtle bug if the input size is set outside of the while loop.
Desired ActionAt line 19523 [XSH accept() ERRORS], change:

Otherwise, -1 shall be returned and errno set to indicate the error.
to:

Otherwise, -1 shall be returned, errno shall be set to indicate the error, and any object pointed to by address_len shall remain unchanged.
Tagstc2-2008

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2014-04-24 13:15 eblake New Issue
2014-04-24 13:15 eblake Name => Eric Blake
2014-04-24 13:15 eblake Organization => Red Hat
2014-04-24 13:15 eblake User Reference => eblake.accept
2014-04-24 13:15 eblake Section => accept
2014-04-24 13:15 eblake Page Number => 563
2014-04-24 13:15 eblake Line Number => 19506
2014-04-24 13:15 eblake Interp Status => ---
2014-04-24 13:17 eblake Description Updated
2014-05-01 16:30 msbrown Status New => Resolved
2014-05-01 16:30 msbrown Resolution Open => Accepted
2014-05-01 16:30 msbrown Tag Attached: tc2-2008
2019-06-10 08:54 agadmin Status Resolved => Closed