View Issue Details

IDProjectCategoryView StatusLast Update
00001661003.1(2008)/Issue 7System Interfacespublic2013-04-16 13:06
Reportergeoffclare Assigned Toajosey  
PrioritynormalSeverityCommentTypeError
Status ClosedResolutionAccepted 
NameGeoff Clare
OrganizationThe Open Group
User Reference
Sectionwait
Page Number2185
Line Number68859,68887
Interp Status---
Final Accepted Text
Summary0000166: errno indeterminate in wait() example
DescriptionThe second example on the wait() page has a signal handler that does
not save and restore errno. Thus the value of errno where it is used
(via perror()) in main() is indeterminate if the signal handler has
been called.

Admittedly the problem could only occur if a fork() error is
encountered after the 2 seconds that the first child sleeps
(i.e. the system would have to be very slow, or heavily loaded),
but I think the change is still worth making in order to demonstrate
the proper way to write signal handlers which make calls that can
change errno.
Desired ActionAt line 68859 insert:

    int sav_errno = errno;

before:

    int status;

After line 68887 add:

    errno = sav_errno;

(indented the same amount as the '}' on line 68887).
Tagstc1-2008

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2009-10-09 15:26 geoffclare New Issue
2009-10-09 15:26 geoffclare Status New => Under Review
2009-10-09 15:26 geoffclare Assigned To => ajosey
2009-10-09 15:26 geoffclare Name => Geoff Clare
2009-10-09 15:26 geoffclare Organization => The Open Group
2009-10-09 15:26 geoffclare Section => wait
2009-10-09 15:26 geoffclare Page Number => 2185
2009-10-09 15:26 geoffclare Line Number => 68859,68887
2009-10-09 15:26 geoffclare Interp Status => ---
2009-10-15 15:43 Don Cragun Status Under Review => Resolved
2009-10-15 15:43 Don Cragun Resolution Open => Accepted
2010-08-27 13:05 ajosey Tag Attached: tc1-2008
2013-04-16 13:06 ajosey Status Resolved => Closed