error handlling in C



Is it generally a good idea to use perror() function to handle all the
error situations ?

For eg in one of my modules I have used it extensively.

int reader()
{
FILE *zeus_file;
....................
.....................

zeus_file = fopen("sphere.zeus", "r");
if(zeus_file == NULL)
{
perror("File open error");
return -1;
}

..............................................

}
.



Relevant Pages

  • Re: error handlling in C
    ... broli wrote, On 28/03/08 15:02: ... int reader() ...
    (comp.lang.c)
  • Re: error handlling in C
    ... int reader() ... If you afterwards decide to use another stream than strerr, ...
    (comp.lang.c)
  • [EXPL] nbSMTP Format String (Exploit)
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... int connect_timeout(int sfd, struct sockaddr *serv_addr, ... perror(" setsockopt()"); ...
    (Securiteam)
  • [UNIX] ngIRCd Format String Vulnerability
    ... int connect_timeout(int sfd, struct sockaddr *serv_addr, ... "\x50" // pushl %eax ... perror(" setsockopt()"); ...
    (Securiteam)
  • Re: Custom Scanf Routine
    ... int flushln ... perror("Input Stream Error"); ... fprintf(stderr, "Too Long Input\n"); ... if(flag) { ...
    (comp.lang.c)