mgansler / mscgen

Automatically exported from code.google.com/p/mscgen
GNU General Public License v2.0
1 stars 0 forks source link

Possible incorrect use of perror #57

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In main.c:

---
         ismap = fopen(gOutputFile, "w");
         if(!ismap)
         {
             fprintf(stderr, "Failed to open ....", [...]);
             perror(NULL);

---

From perror(3):

Note that errno is undefined after a successful library call: this call may 
well change this variable, even though it succeeds, for example because it 
internally used some other library function that failed.  Thus, if a failing 
call is not immediately followed by a call to perror(), the value of errno 
should be saved.

Original issue reported on code.google.com by NThykier@gmail.com on 29 Dec 2010 at 4:10

Attachments:

GoogleCodeExporter commented 8 years ago
Good spot.  I'll change it to use strerror(errno) in the fprintf line, and 
check of any other occurrences of the same problem in the code.

Original comment by Michael....@gmail.com on 31 Dec 2010 at 2:47

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r169.

Original comment by Michael....@gmail.com on 31 Dec 2010 at 3:07