Austin Group Defect Tracker

Aardvark Mark IV


Viewing Issue Simple Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Type Date Submitted Last Update
0000397 [1003.1(2008)/Issue 7] System Interfaces Objection Error 2011-03-17 18:36 2013-04-16 13:06
Reporter eblake View Status public  
Assigned To ajosey
Priority normal Resolution Accepted As Marked  
Status Closed  
Name Eric Blake
Organization Red Hat
User Reference ebb.setbuf
Section setbuf
Page Number 1855
Line Number 59282
Interp Status ---
Final Accepted Text See Note: 0000799
Summary 0000397: setbuf and errno
Description Since setbuf is required to be implemented in terms of setvbuf, and the
latter is documented as being permitted to set errno on failure, we must
document how to detect the same failure for setbuf.
Desired Action At line 59278 [XSH setbuf DESCRIPTION], add a paragraph with CX shading:

setbuf() shall not modify errno on success. Since no value is returned, an
application wishing to check for error situations should set errno to 0,
call setbuf(), then check errno.

At line 59282 [ERRORS], replace "None." with:

    [CX] Refer to [xref to setvbuf()]. [/CX]
Tags tc1-2008
Attached Files

- Relationships
related to 0000384Closedajosey the stdarg macros should not modify errno 

-  Notes
(0000798)
geoffclare (manager)
2011-05-27 09:39

This fixes the discrepancy between setbuf() and setvbuf() for errors,
but it also introduces one for successful calls, since setvbuf() is
allowed to set errno on success.

I suggest the following changes instead of the Desired Action:

At line 59272 [XSH setbuf DESCRIPTION] change:

    Except that it returns no value, the function call:

    setbuf(stream, buf)

    shall be equivalent to:

    setvbuf(stream, buf, _IOFBF, BUFSIZ)

    if buf is not a null pointer, or to:

    setvbuf(stream, buf, _IONBF, BUFSIZ)

    if buf is a null pointer.

to:

    The function call:

    setbuf(stream, buf)

    shall be equivalent to:

    (void) setvbuf(stream, buf, _IOFBF, BUFSIZ)

    if buf is not a null pointer, or to:

    (void) setvbuf(stream, buf, _IONBF, BUFSIZ)

    if buf is a null pointer, [CX]except that setbuf() shall not
    modify errno on success[/CX].

    [CX]Since no value is returned, an application wishing to check for
    error situations should set errno to 0, call setbuf(), then check
    errno.[/CX]

At line 59282 [ERRORS], replace "None." with:

    [CX]Refer to [xref to setvbuf()].[/CX]
(0000799)
nick (manager)
2011-06-02 15:26

Since existing implementations do not work to preserve errno values in the case of no error, the following changes should be made instead:

At p 1855 line 59282, change ERRORS text from:
 No errors are defined.
To:
 Although the setvbuf() interface may set errno in defined ways, the value of errno after a call to setbuf() is unspecified.

At line 59289 add to Application Usage:
 Since errno is not required to be unchanged on success, in order to correctly detect and possibly recover from errors, applications should use setvbuf() instead of setbuf().

- Issue History
Date Modified Username Field Change
2011-03-17 18:36 eblake New Issue
2011-03-17 18:36 eblake Status New => Under Review
2011-03-17 18:36 eblake Assigned To => ajosey
2011-03-17 18:36 eblake Name => Eric Blake
2011-03-17 18:36 eblake Organization => Red Hat
2011-03-17 18:36 eblake User Reference => ebb.setbuf
2011-03-17 18:36 eblake Section => setbuf
2011-03-17 18:36 eblake Page Number => 1855
2011-03-17 18:36 eblake Line Number => 59282
2011-03-17 18:36 eblake Interp Status => ---
2011-05-26 15:50 msbrown Tag Attached: tc1-2008
2011-05-26 15:50 msbrown Status Under Review => Resolved
2011-05-26 15:50 msbrown Resolution Open => Accepted
2011-05-27 09:39 geoffclare Note Added: 0000798
2011-05-27 09:39 geoffclare Status Resolved => Under Review
2011-05-27 09:39 geoffclare Resolution Accepted => Reopened
2011-06-02 15:26 nick Note Added: 0000799
2011-06-02 15:29 nick Final Accepted Text => See Note: 0000799
2011-06-02 15:29 nick Status Under Review => Resolved
2011-06-02 15:29 nick Resolution Reopened => Accepted As Marked
2013-04-16 13:06 ajosey Status Resolved => Closed
2016-07-28 15:08 eblake Relationship added related to 0000384


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker