| Anonymous | Login | Signup for a new account | 2010-09-09 05:44 UTC |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
| ID | Category | Severity | Type | Date Submitted | Last Update | ||||||||
| 0000166 | [1003.1(2008)/Issue 7] System Interfaces | Comment | Error | 2009-10-09 15:26 | 2009-10-15 15:43 | ||||||||
| Reporter | geoffclare | View Status | public | ||||||||||
| Assigned To | ajosey | ||||||||||||
| Priority | normal | Resolution | Accepted | ||||||||||
| Status | Resolved | ||||||||||||
| Name | Geoff Clare | ||||||||||||
| Organization | The Open Group | ||||||||||||
| User Reference | |||||||||||||
| Section | wait | ||||||||||||
| Page Number | 2185 | ||||||||||||
| Line Number | 68859,68887 | ||||||||||||
| Interp Status | --- | ||||||||||||
| Final Accepted Text | |||||||||||||
| Summary | 0000166: errno indeterminate in wait() example | ||||||||||||
| Description |
The 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 Action |
At 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). |
||||||||||||
| Tags | tc1-2008 | ||||||||||||
| Attached Files | |||||||||||||
|
|
|||||||||||||
| There are no notes attached to this issue. |
| Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |